[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, ...@@ -91,12 +91,11 @@ void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
gfx::Vector2d dest_offset, gfx::Vector2d dest_offset,
bool partial_update) { bool partial_update) {
CHECK(canvas_); CHECK(canvas_);
ResourceUpdate upload = ResourceUpdate upload = ResourceUpdate::Create(texture,
ResourceUpdate::CreateFromCanvas(texture, &bitmap_backing_,
canvas_, content_rect(),
content_rect(), source_rect,
source_rect, dest_offset);
dest_offset);
if (partial_update) if (partial_update)
queue->AppendPartialUpload(upload); queue->AppendPartialUpload(upload);
else else
......
...@@ -5,37 +5,18 @@ ...@@ -5,37 +5,18 @@
#include "cc/resources/resource_update.h" #include "cc/resources/resource_update.h"
#include "base/logging.h" #include "base/logging.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkDevice.h"
namespace cc { namespace cc {
ResourceUpdate ResourceUpdate::Create(PrioritizedResource* texture, ResourceUpdate ResourceUpdate::Create(PrioritizedResource* resource,
const SkBitmap* bitmap, const SkBitmap* bitmap,
gfx::Rect content_rect, gfx::Rect content_rect,
gfx::Rect source_rect, gfx::Rect source_rect,
gfx::Vector2d dest_offset) { gfx::Vector2d dest_offset) {
CHECK(content_rect.Contains(source_rect)); CHECK(content_rect.Contains(source_rect));
ResourceUpdate update; 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.texture = resource;
update.canvas = canvas; update.bitmap = bitmap;
update.bitmap = &canvas->getDevice()->accessBitmap(false);
update.content_rect = content_rect; update.content_rect = content_rect;
update.source_rect = source_rect; update.source_rect = source_rect;
update.dest_offset = dest_offset; update.dest_offset = dest_offset;
......
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
#ifndef CC_RESOURCES_RESOURCE_UPDATE_H_ #ifndef CC_RESOURCES_RESOURCE_UPDATE_H_
#define CC_RESOURCES_RESOURCE_UPDATE_H_ #define CC_RESOURCES_RESOURCE_UPDATE_H_
#include "base/memory/ref_counted.h"
#include "cc/base/cc_export.h" #include "cc/base/cc_export.h"
#include "skia/ext/refptr.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
#include "ui/gfx/vector2d.h" #include "ui/gfx/vector2d.h"
class SkBitmap; class SkBitmap;
class SkCanvas;
namespace cc { namespace cc {
...@@ -24,18 +21,12 @@ struct CC_EXPORT ResourceUpdate { ...@@ -24,18 +21,12 @@ struct CC_EXPORT ResourceUpdate {
gfx::Rect content_rect, gfx::Rect content_rect,
gfx::Rect source_rect, gfx::Rect source_rect,
gfx::Vector2d dest_offset); 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(); ResourceUpdate();
virtual ~ResourceUpdate(); virtual ~ResourceUpdate();
PrioritizedResource* texture; PrioritizedResource* texture;
const SkBitmap* bitmap; const SkBitmap* bitmap;
skia::RefPtr<SkCanvas> canvas;
gfx::Rect content_rect; gfx::Rect content_rect;
gfx::Rect source_rect; gfx::Rect source_rect;
gfx::Vector2d dest_offset; 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