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

Unified Diff: cc/test/skia_common.cc

Issue 2160683003: Fix MultiPictureDraw issues with GpuImageDecodeController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « cc/raster/raster_buffer_provider_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/skia_common.cc
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index 980fc4b2b82492c369260dd94b2d7f23202ef361..d7ffe2f0948728b5f8896c4b403897bbc381cd8a 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -9,6 +9,7 @@
#include "cc/playback/display_item_list.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImageGenerator.h"
+#include "third_party/skia/include/core/SkPixmap.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/skia_util.h"
@@ -19,7 +20,22 @@ namespace {
class TestImageGenerator : public SkImageGenerator {
public:
explicit TestImageGenerator(const SkImageInfo& info)
- : SkImageGenerator(info) {}
+ : SkImageGenerator(info),
+ image_backing_memory_(info.getSafeSize(info.minRowBytes()), 0),
+ image_pixmap_(info, image_backing_memory_.data(), info.minRowBytes()) {}
+
+ protected:
+ bool onGetPixels(const SkImageInfo& info,
+ void* pixels,
+ size_t rowBytes,
+ SkPMColor ctable[],
+ int* ctableCount) override {
+ return image_pixmap_.readPixels(info, pixels, rowBytes, 0, 0);
+ }
+
+ private:
+ std::vector<uint8_t> image_backing_memory_;
+ SkPixmap image_pixmap_;
};
} // anonymous namespace
« no previous file with comments | « cc/raster/raster_buffer_provider_unittest.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698