<commit_before>// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/glue/media/video_renderer_impl.h"

#include "base/logging.h"
#include "media/base/video_frame.h"
#include "media/base/yuv_convert.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "webkit/glue/webmediaplayer_proxy.h"

// Transform destination rect to local coordinates.
static void TransformToSkIRect(const SkMatrix& matrix,
                               const gfx::Rect& src_rect,
                               SkIRect* dest_rect) {
  SkRect transformed_rect;
  SkRect skia_dest_rect;
  skia_dest_rect.iset(src_rect.x(), src_rect.y(),
                      src_rect.right(), src_rect.bottom());
  matrix.mapRect(&transformed_rect, skia_dest_rect);
  transformed_rect.round(dest_rect);
}

namespace webkit_glue {

VideoRendererImpl::VideoRendererImpl(bool pts_logging)
    : last_converted_frame_(NULL),
      pts_logging_(pts_logging) {
}

VideoRendererImpl::~VideoRendererImpl() {}

bool VideoRendererImpl::OnInitialize(media::VideoDecoder* decoder) {
  video_size_.SetSize(decoder->width(), decoder->height());
  bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
                    decoder->width(), decoder->height());
  bitmap_.allocPixels();
  bitmap_.eraseRGB(0x00, 0x00, 0x00);
  return true;<commit_msg>Mark the SkBitmap used for video uploads as volatile.  This tells Ganesh (Skia) not to create and destroy a GL texture on  each upload of a new frame. Review URL: http://codereview.chromium.org/7620011<commit_after>// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/glue/media/video_renderer_impl.h"

#include "base/logging.h"
#include "media/base/video_frame.h"
#include "media/base/yuv_convert.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "webkit/glue/webmediaplayer_proxy.h"

// Transform destination rect to local coordinates.
static void TransformToSkIRect(const SkMatrix& matrix,
                               const gfx::Rect& src_rect,
                               SkIRect* dest_rect) {
  SkRect transformed_rect;
  SkRect skia_dest_rect;
  skia_dest_rect.iset(src_rect.x(), src_rect.y(),
                      src_rect.right(), src_rect.bottom());
  matrix.mapRect(&transformed_rect, skia_dest_rect);
  transformed_rect.round(dest_rect);
}

namespace webkit_glue {

VideoRendererImpl::VideoRendererImpl(bool pts_logging)
    : last_converted_frame_(NULL),
      pts_logging_(pts_logging) {
}

VideoRendererImpl::~VideoRendererImpl() {}

bool VideoRendererImpl::OnInitialize(media::VideoDecoder* decoder) {
  video_size_.SetSize(decoder->width(), decoder->height());
  bitmap_.setConfig(SkBitmap::kARGB_8888_Config,
                    decoder->width(), decoder->height());
  bitmap_.allocPixels();
  bitmap_.eraseRGB(0x00, 0x00, 0x00);
  bitmap_.setIsVolatile(true);
  return true;
{'fraction_non_alphanumeric': 0.11418685121107267, 'fraction_numerical': 0.012897137464611514, 'mean_word_length': 4.0157728706624605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6332409', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1001, 'n_words': 212}