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

Side by Side Diff: third_party/WebKit/Source/platform/DragImageTest.cpp

Issue 2559013002: Add ColorBehavior to blink::Image draw methods (Closed)
Patch Set: Rebase 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 static PassRefPtr<TestImage> create(const IntSize& size) { 58 static PassRefPtr<TestImage> create(const IntSize& size) {
59 return adoptRef(new TestImage(size)); 59 return adoptRef(new TestImage(size));
60 } 60 }
61 61
62 IntSize size() const override { 62 IntSize size() const override {
63 ASSERT(m_image); 63 ASSERT(m_image);
64 64
65 return IntSize(m_image->width(), m_image->height()); 65 return IntSize(m_image->width(), m_image->height());
66 } 66 }
67 67
68 sk_sp<SkImage> imageForCurrentFrame() override { return m_image; } 68 sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override {
69 return m_image;
70 }
69 71
70 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { 72 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override {
71 return false; 73 return false;
72 } 74 }
73 75
74 void destroyDecodedData() override { 76 void destroyDecodedData() override {
75 // Image pure virtual stub. 77 // Image pure virtual stub.
76 } 78 }
77 79
78 void draw(SkCanvas*, 80 void draw(SkCanvas*,
79 const SkPaint&, 81 const SkPaint&,
80 const FloatRect&, 82 const FloatRect&,
81 const FloatRect&, 83 const FloatRect&,
82 RespectImageOrientationEnum, 84 RespectImageOrientationEnum,
83 ImageClampingMode) override { 85 ImageClampingMode,
86 const ColorBehavior&) override {
84 // Image pure virtual stub. 87 // Image pure virtual stub.
85 } 88 }
86 89
87 private: 90 private:
88 explicit TestImage(sk_sp<SkImage> image) : m_image(image) {} 91 explicit TestImage(sk_sp<SkImage> image) : m_image(image) {}
89 92
90 explicit TestImage(IntSize size) : m_image(nullptr) { 93 explicit TestImage(IntSize size) : m_image(nullptr) {
91 sk_sp<SkSurface> surface = createSkSurface(size); 94 sk_sp<SkSurface> surface = createSkSurface(size);
92 if (!surface) 95 if (!surface)
93 return; 96 return;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 222 {
220 SkAutoLockPixels lock1(dragBitmap); 223 SkAutoLockPixels lock1(dragBitmap);
221 SkAutoLockPixels lock2(expectedBitmap); 224 SkAutoLockPixels lock2(expectedBitmap);
222 for (int x = 0; x < dragBitmap.width(); ++x) 225 for (int x = 0; x < dragBitmap.width(); ++x)
223 for (int y = 0; y < dragBitmap.height(); ++y) 226 for (int y = 0; y < dragBitmap.height(); ++y)
224 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y)); 227 EXPECT_EQ(expectedBitmap.getColor(x, y), dragBitmap.getColor(x, y));
225 } 228 }
226 } 229 }
227 230
228 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/DragImage.cpp ('k') | third_party/WebKit/Source/platform/exported/WebImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698