| Index: skia/ext/discardable_pixel_ref_utils_unittest.cc
|
| diff --git a/skia/ext/lazy_pixel_ref_utils_unittest.cc b/skia/ext/discardable_pixel_ref_utils_unittest.cc
|
| similarity index 76%
|
| rename from skia/ext/lazy_pixel_ref_utils_unittest.cc
|
| rename to skia/ext/discardable_pixel_ref_utils_unittest.cc
|
| index 054613341fd13b5e09faa65d2f0a1d478abd064f..cc49511eddbb996e25f79ed7324ef483c891b294 100644
|
| --- a/skia/ext/lazy_pixel_ref_utils_unittest.cc
|
| +++ b/skia/ext/discardable_pixel_ref_utils_unittest.cc
|
| @@ -5,13 +5,13 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "cc/test/geometry_test_utils.h"
|
| -#include "skia/ext/lazy_pixel_ref.h"
|
| -#include "skia/ext/lazy_pixel_ref_utils.h"
|
| +#include "skia/ext/discardable_pixel_ref_utils.h"
|
| #include "skia/ext/refptr.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkFlattenableBuffers.h"
|
| +#include "third_party/skia/include/core/SkPixelRef.h"
|
| #include "third_party/skia/include/core/SkPoint.h"
|
| #include "third_party/skia/include/core/SkShader.h"
|
| #include "third_party/skia/src/core/SkOrderedReadBuffer.h"
|
| @@ -39,29 +39,13 @@ class TestPixelRef : public SkPixelRef {
|
| scoped_ptr<char[]> pixels_;
|
| };
|
|
|
| -class TestLazyPixelRef : public skia::LazyPixelRef {
|
| +class TestDiscardableShader : public SkShader {
|
| public:
|
| - TestLazyPixelRef(int width, int height);
|
| - virtual ~TestLazyPixelRef();
|
| -
|
| - virtual SkFlattenable::Factory getFactory() const OVERRIDE;
|
| - virtual void* onLockPixels(SkColorTable** color_table) OVERRIDE;
|
| - virtual void onUnlockPixels() OVERRIDE {}
|
| - virtual bool PrepareToDecode(const PrepareParams& params) OVERRIDE;
|
| - virtual bool MaybeDecoded() OVERRIDE;
|
| - virtual SkPixelRef* deepCopy(SkBitmap::Config config, const SkIRect* subset)
|
| - OVERRIDE;
|
| - virtual void Decode() OVERRIDE {}
|
| -
|
| - private:
|
| - scoped_ptr<char[]> pixels_;
|
| -};
|
| -
|
| -class TestLazyShader : public SkShader {
|
| - public:
|
| - TestLazyShader() { CreateBitmap(gfx::Size(50, 50), "lazy", &bitmap_); }
|
| + TestDiscardableShader() {
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_);
|
| + }
|
|
|
| - TestLazyShader(SkFlattenableReadBuffer& flattenable_buffer) {
|
| + TestDiscardableShader(SkFlattenableReadBuffer& flattenable_buffer) {
|
| SkOrderedReadBuffer& buffer =
|
| static_cast<SkOrderedReadBuffer&>(flattenable_buffer);
|
| SkReader32* reader = buffer.getReader32();
|
| @@ -70,7 +54,7 @@ class TestLazyShader : public SkShader {
|
| uint32_t toSkip = reader->readU32();
|
| reader->skip(toSkip);
|
|
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &bitmap_);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_);
|
| }
|
|
|
| virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap,
|
| @@ -83,7 +67,7 @@ class TestLazyShader : public SkShader {
|
|
|
| // Pure virtual implementaiton.
|
| virtual void shadeSpan(int x, int y, SkPMColor[], int count) OVERRIDE {}
|
| - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestLazyShader);
|
| + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader);
|
|
|
| private:
|
| SkBitmap bitmap_;
|
| @@ -106,38 +90,13 @@ SkPixelRef* TestPixelRef::deepCopy(SkBitmap::Config config,
|
| return this;
|
| }
|
|
|
| -TestLazyPixelRef::TestLazyPixelRef(int width, int height)
|
| - : pixels_(new char[4 * width * height]) {}
|
| -
|
| -TestLazyPixelRef::~TestLazyPixelRef() {}
|
| -
|
| -SkFlattenable::Factory TestLazyPixelRef::getFactory() const { return NULL; }
|
| -
|
| -void* TestLazyPixelRef::onLockPixels(SkColorTable** color_table) {
|
| - return pixels_.get();
|
| -}
|
| -
|
| -bool TestLazyPixelRef::PrepareToDecode(const PrepareParams& params) {
|
| - return true;
|
| -}
|
| -
|
| -bool TestLazyPixelRef::MaybeDecoded() {
|
| - return true;
|
| -}
|
| -
|
| -SkPixelRef* TestLazyPixelRef::deepCopy(SkBitmap::Config config,
|
| - const SkIRect* subset) {
|
| - this->ref();
|
| - return this;
|
| -}
|
| -
|
| void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
|
| - skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref =
|
| - skia::AdoptRef(new TestLazyPixelRef(size.width(), size.height()));
|
| - lazy_pixel_ref->setURI(uri);
|
| + skia::RefPtr<TestPixelRef> pixel_ref =
|
| + skia::AdoptRef(new TestPixelRef(size.width(), size.height()));
|
| + pixel_ref->setURI(uri);
|
|
|
| bitmap->setConfig(SkBitmap::kARGB_8888_Config, size.width(), size.height());
|
| - bitmap->setPixelRef(lazy_pixel_ref.get());
|
| + bitmap->setPixelRef(pixel_ref.get());
|
| }
|
|
|
| SkCanvas* StartRecording(SkPicture* picture, gfx::Rect layer_rect) {
|
| @@ -162,21 +121,21 @@ void StopRecording(SkPicture* picture, SkCanvas* canvas) {
|
|
|
| } // namespace
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawPaint) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawPaint) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -189,8 +148,8 @@ TEST(LazyPixelRefUtilsTest, DrawPaint) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 256, 256),
|
| @@ -201,21 +160,21 @@ TEST(LazyPixelRefUtilsTest, DrawPaint) {
|
| gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawPoints) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawPoints) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -242,8 +201,8 @@ TEST(LazyPixelRefUtilsTest, DrawPoints) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90),
|
| @@ -254,21 +213,21 @@ TEST(LazyPixelRefUtilsTest, DrawPoints) {
|
| gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawRect) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawRect) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -288,8 +247,8 @@ TEST(LazyPixelRefUtilsTest, DrawRect) {
|
| // (50, 50, 50, 50)
|
| canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 20, 30, 40),
|
| @@ -300,21 +259,21 @@ TEST(LazyPixelRefUtilsTest, DrawRect) {
|
| gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawRRect) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawRRect) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -339,8 +298,8 @@ TEST(LazyPixelRefUtilsTest, DrawRRect) {
|
| // (50, 50, 50, 50)
|
| canvas->drawRRect(rrect, third_paint);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 20, 30, 40),
|
| @@ -351,21 +310,21 @@ TEST(LazyPixelRefUtilsTest, DrawRRect) {
|
| gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawOval) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawOval) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -389,8 +348,8 @@ TEST(LazyPixelRefUtilsTest, DrawOval) {
|
| // (50, 50, 50, 50)
|
| canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(20, 10, 60, 20),
|
| @@ -401,17 +360,17 @@ TEST(LazyPixelRefUtilsTest, DrawOval) {
|
| gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawPath) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawPath) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| @@ -433,8 +392,8 @@ TEST(LazyPixelRefUtilsTest, DrawPath) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(2u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(12, 13, 38, 88),
|
| @@ -443,22 +402,22 @@ TEST(LazyPixelRefUtilsTest, DrawPath) {
|
| gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawBitmap) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawBitmap) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| SkBitmap first;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &first);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &first);
|
| SkBitmap second;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &second);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &second);
|
| SkBitmap third;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &third);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &third);
|
| SkBitmap fourth;
|
| - CreateBitmap(gfx::Size(50, 1), "lazy", &fourth);
|
| + CreateBitmap(gfx::Size(50, 1), "discardable", &fourth);
|
| SkBitmap fifth;
|
| - CreateBitmap(gfx::Size(10, 10), "lazy", &fifth);
|
| + CreateBitmap(gfx::Size(10, 10), "discardable", &fifth);
|
|
|
| canvas->save();
|
|
|
| @@ -487,8 +446,8 @@ TEST(LazyPixelRefUtilsTest, DrawBitmap) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(5u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 50, 50),
|
| @@ -504,33 +463,34 @@ TEST(LazyPixelRefUtilsTest, DrawBitmap) {
|
|
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawBitmapRect) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawBitmapRect) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| SkBitmap first;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &first);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &first);
|
| SkBitmap second;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &second);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &second);
|
| SkBitmap third;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &third);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &third);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - SkPaint non_lazy_paint;
|
| + SkPaint non_discardable_paint;
|
|
|
| canvas->save();
|
|
|
| // (0, 0, 100, 100).
|
| - canvas->drawBitmapRect(first, SkRect::MakeWH(100, 100), &non_lazy_paint);
|
| + canvas->drawBitmapRect(
|
| + first, SkRect::MakeWH(100, 100), &non_discardable_paint);
|
| canvas->translate(25, 0);
|
| // (75, 50, 10, 10).
|
| canvas->drawBitmapRect(
|
| - second, SkRect::MakeXYWH(50, 50, 10, 10), &non_lazy_paint);
|
| + second, SkRect::MakeXYWH(50, 50, 10, 10), &non_discardable_paint);
|
| canvas->translate(5, 50);
|
| // (0, 30, 100, 100). One from bitmap, one from paint.
|
| canvas->drawBitmapRect(
|
| @@ -540,8 +500,8 @@ TEST(LazyPixelRefUtilsTest, DrawBitmapRect) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(4u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100),
|
| @@ -554,22 +514,22 @@ TEST(LazyPixelRefUtilsTest, DrawBitmapRect) {
|
| gfx::SkRectToRectF(pixel_refs[3].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawSprite) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawSprite) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| SkBitmap first;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &first);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &first);
|
| SkBitmap second;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &second);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &second);
|
| SkBitmap third;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &third);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &third);
|
| SkBitmap fourth;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &fourth);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &fourth);
|
| SkBitmap fifth;
|
| - CreateBitmap(gfx::Size(50, 50), "lazy", &fifth);
|
| + CreateBitmap(gfx::Size(50, 50), "discardable", &fifth);
|
|
|
| canvas->save();
|
|
|
| @@ -593,7 +553,7 @@ TEST(LazyPixelRefUtilsTest, DrawSprite) {
|
|
|
| canvas->restore();
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| @@ -603,8 +563,8 @@ TEST(LazyPixelRefUtilsTest, DrawSprite) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(6u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 50, 50),
|
| @@ -621,13 +581,13 @@ TEST(LazyPixelRefUtilsTest, DrawSprite) {
|
| gfx::SkRectToRectF(pixel_refs[5].pixel_ref_rect));
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawText) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawText) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| @@ -648,27 +608,27 @@ TEST(LazyPixelRefUtilsTest, DrawText) {
|
| canvas->drawPosText("text", 4, points, first_paint);
|
| canvas->drawTextOnPath("text", 4, path, NULL, first_paint);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| }
|
|
|
| -TEST(LazyPixelRefUtilsTest, DrawVertices) {
|
| +TEST(DiscardablePixelRefUtilsTest, DrawVertices) {
|
| gfx::Rect layer_rect(0, 0, 256, 256);
|
|
|
| skia::RefPtr<SkPicture> picture = skia::AdoptRef(new SkPicture);
|
| SkCanvas* canvas = StartRecording(picture.get(), layer_rect);
|
|
|
| - TestLazyShader first_shader;
|
| + TestDiscardableShader first_shader;
|
| SkPaint first_paint;
|
| first_paint.setShader(&first_shader);
|
|
|
| - TestLazyShader second_shader;
|
| + TestDiscardableShader second_shader;
|
| SkPaint second_paint;
|
| second_paint.setShader(&second_shader);
|
|
|
| - TestLazyShader third_shader;
|
| + TestDiscardableShader third_shader;
|
| SkPaint third_paint;
|
| third_paint.setShader(&third_shader);
|
|
|
| @@ -721,8 +681,8 @@ TEST(LazyPixelRefUtilsTest, DrawVertices) {
|
|
|
| StopRecording(picture.get(), canvas);
|
|
|
| - std::vector<skia::LazyPixelRefUtils::PositionLazyPixelRef> pixel_refs;
|
| - skia::LazyPixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
| + std::vector<skia::DiscardablePixelRefUtils::PositionPixelRef> pixel_refs;
|
| + skia::DiscardablePixelRefUtils::GatherPixelRefs(picture.get(), &pixel_refs);
|
|
|
| EXPECT_EQ(3u, pixel_refs.size());
|
| EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90),
|
|
|