Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(429)

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
index 8be1eb71d66a1c5f8ec388a00b4dc1798b4a6760..cf345ce2318cbc0523a89de4a4fa7362a0f12440 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -37,8 +37,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
-#include "third_party/skia/include/core/SkPicture.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
+#include "skia/ext/cdl_canvas.h"
+#include "skia/ext/cdl_surface.h"
+#include "skia/ext/cdl_picture.h"
+#include "skia/ext/cdl_picture_recorder.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "wtf/PassRefPtr.h"
@@ -84,7 +86,7 @@ const unsigned char animatedGIF[] = {
struct Rasterizer {
SkCanvas* canvas;
- SkPicture* picture;
+ CdlPicture* picture;
};
} // namespace
@@ -100,7 +102,7 @@ class DeferredImageDecoderTest : public ::testing::Test,
m_actualDecoder = decoder.get();
m_actualDecoder->setSize(1, 1);
m_lazyDecoder = DeferredImageDecoder::createForTesting(std::move(decoder));
- m_surface = SkSurface::MakeRasterN32Premul(100, 100);
+ m_surface = CdlSurface::MakeRasterN32Premul(100, 100);
ASSERT_TRUE(m_surface.get());
m_decodeRequestCount = 0;
m_repetitionCount = cAnimationNone;
@@ -134,7 +136,7 @@ class DeferredImageDecoderTest : public ::testing::Test,
// Don't own this but saves the pointer to query states.
MockImageDecoder* m_actualDecoder;
std::unique_ptr<DeferredImageDecoder> m_lazyDecoder;
- sk_sp<SkSurface> m_surface;
+ sk_sp<CdlSurface> m_surface;
int m_decodeRequestCount;
RefPtr<SharedBuffer> m_data;
size_t m_frameCount;
@@ -151,10 +153,10 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPicture) {
EXPECT_EQ(1, image->width());
EXPECT_EQ(1, image->height());
- SkPictureRecorder recorder;
- SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
+ CdlPictureRecorder recorder;
+ CdlCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
+ sk_sp<CdlPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
m_surface->getCanvas()->drawPicture(picture);
@@ -175,12 +177,12 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive) {
m_lazyDecoder->setData(partialData, false);
sk_sp<SkImage> image = m_lazyDecoder->createFrameAtIndex(0);
ASSERT_TRUE(image);
- SkPictureRecorder recorder;
- SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
+ CdlPictureRecorder recorder;
+ CdlCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
m_surface->getCanvas()->drawPicture(recorder.finishRecordingAsPicture());
- // Fully received the file and draw the SkPicture again.
+ // Fully received the file and draw the CdlPicture again.
m_lazyDecoder->setData(m_data, true);
image = m_lazyDecoder->createFrameAtIndex(0);
ASSERT_TRUE(image);
@@ -195,7 +197,7 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive) {
EXPECT_EQ(SkColorSetARGB(255, 255, 255, 255), canvasBitmap.getColor(0, 0));
}
-static void rasterizeMain(SkCanvas* canvas, SkPicture* picture) {
+static void rasterizeMain(CdlCanvas* canvas, CdlPicture* picture) {
canvas->drawPicture(picture);
}
@@ -206,13 +208,13 @@ TEST_F(DeferredImageDecoderTest, decodeOnOtherThread) {
EXPECT_EQ(1, image->width());
EXPECT_EQ(1, image->height());
- SkPictureRecorder recorder;
- SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
+ CdlPictureRecorder recorder;
+ CdlCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
+ sk_sp<CdlPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
- // Create a thread to rasterize SkPicture.
+ // Create a thread to rasterize CdlPicture.
std::unique_ptr<WebThread> thread =
wrapUnique(Platform::current()->createThread("RasterThread"));
thread->getWebTaskRunner()->postTask(
@@ -306,10 +308,10 @@ TEST_F(DeferredImageDecoderTest, decodedSize) {
useMockImageDecoderFactory();
// The following code should not fail any assert.
- SkPictureRecorder recorder;
- SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
+ CdlPictureRecorder recorder;
+ CdlCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
+ sk_sp<CdlPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
m_surface->getCanvas()->drawPicture(picture);
EXPECT_EQ(1, m_decodeRequestCount);

Powered by Google App Engine
This is Rietveld 408576698