[cc] Unify static create method of ResourceUpdate

Remove ResourceUpdate::CreateFromCanvas().
|canvas| member variable of ResourceUpdate is not used by ResourceUpdateController.
Also all customer of ResourceUpdate can pass SkBitmap.

R=enne@chromium.org, danakj@chromium.org
BUG=NONE
TEST=cc_unittests --gtest_filter=ResourceUpdateControllerTest.*

Review URL: https://codereview.chromium.org/127053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243856 0039d316-1c4b-4281-b951-d872f2087c98
parent f8819d7e
......@@ -91,12 +91,11 @@ void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
gfx::Vector2d dest_offset,
bool partial_update) {
CHECK(canvas_);
ResourceUpdate upload =
ResourceUpdate::CreateFromCanvas(texture,
canvas_,
content_rect(),
source_rect,
dest_offset);
ResourceUpdate upload = ResourceUpdate::Create(texture,
&bitmap_backing_,
content_rect(),
source_rect,
dest_offset);
if (partial_update)
queue->AppendPartialUpload(upload);
else
......
......@@ -5,37 +5,18 @@
#include "cc/resources/resource_update.h"
#include "base/logging.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
namespace cc {
ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture,
ResourceUpdate ResourceUpdate::Create(PrioritizedResource* resource,
const SkBitmap* bitmap,
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset) {
CHECK(content_rect.Contains(source_rect));
ResourceUpdate update;
update.texture = texture;
update.bitmap = bitmap;
update.content_rect = content_rect;
update.source_rect = source_rect;
update.dest_offset = dest_offset;
return update;
}
ResourceUpdate ResourceUpdate::CreateFromCanvas(
PrioritizedResource* resource,
const skia::RefPtr<SkCanvas>& canvas,
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset) {
CHECK(content_rect.Contains(source_rect));
ResourceUpdate update;
update.texture = resource;
update.canvas = canvas;
update.bitmap = &canvas->getDevice()->accessBitmap(false);
update.bitmap = bitmap;
update.content_rect = content_rect;
update.source_rect = source_rect;
update.dest_offset = dest_offset;
......
......@@ -5,14 +5,11 @@
#ifndef CC_RESOURCES_RESOURCE_UPDATE_H_
#define CC_RESOURCES_RESOURCE_UPDATE_H_
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h"
#include "skia/ext/refptr.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/vector2d.h"
class SkBitmap;
class SkCanvas;
namespace cc {
......@@ -24,18 +21,12 @@ struct CC_EXPORT ResourceUpdate {
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset);
static ResourceUpdate CreateFromCanvas(PrioritizedResource* resource,
const skia::RefPtr<SkCanvas>& canvas,
gfx::Rect content_rect,
gfx::Rect source_rect,
gfx::Vector2d dest_offset);
ResourceUpdate();
virtual ~ResourceUpdate();
PrioritizedResource* texture;
const SkBitmap* bitmap;
skia::RefPtr<SkCanvas> canvas;
gfx::Rect content_rect;
gfx::Rect source_rect;
gfx::Vector2d dest_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment