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

Side by Side Diff: cc/test/skia_common.cc

Issue 2888603002: Replace uses of legacy SkImageGenerator API (Closed)
Patch Set: Use ternary Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/skia_common.h" 5 #include "cc/test/skia_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "cc/paint/display_item_list.h" 10 #include "cc/paint/display_item_list.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 explicit TestImageGenerator(const SkImageInfo& info) 23 explicit TestImageGenerator(const SkImageInfo& info)
24 : SkImageGenerator(info), 24 : SkImageGenerator(info),
25 image_backing_memory_(info.getSafeSize(info.minRowBytes()), 0), 25 image_backing_memory_(info.getSafeSize(info.minRowBytes()), 0),
26 image_pixmap_(info, image_backing_memory_.data(), info.minRowBytes()) {} 26 image_pixmap_(info, image_backing_memory_.data(), info.minRowBytes()) {}
27 27
28 protected: 28 protected:
29 bool onGetPixels(const SkImageInfo& info, 29 bool onGetPixels(const SkImageInfo& info,
30 void* pixels, 30 void* pixels,
31 size_t rowBytes, 31 size_t rowBytes,
32 SkPMColor ctable[], 32 const Options&) override {
33 int* ctableCount) override {
34 return image_pixmap_.readPixels(info, pixels, rowBytes, 0, 0); 33 return image_pixmap_.readPixels(info, pixels, rowBytes, 0, 0);
35 } 34 }
36 35
37 private: 36 private:
38 std::vector<uint8_t> image_backing_memory_; 37 std::vector<uint8_t> image_backing_memory_;
39 SkPixmap image_pixmap_; 38 SkPixmap image_pixmap_;
40 }; 39 };
41 40
42 } // anonymous namespace 41 } // anonymous namespace
43 42
(...skipping 23 matching lines...) Expand all
67 66
68 return !memcmp(pixels_a.get(), pixels_b.get(), pixel_size); 67 return !memcmp(pixels_a.get(), pixels_b.get(), pixel_size);
69 } 68 }
70 69
71 sk_sp<SkImage> CreateDiscardableImage(const gfx::Size& size) { 70 sk_sp<SkImage> CreateDiscardableImage(const gfx::Size& size) {
72 return SkImage::MakeFromGenerator(base::MakeUnique<TestImageGenerator>( 71 return SkImage::MakeFromGenerator(base::MakeUnique<TestImageGenerator>(
73 SkImageInfo::MakeN32Premul(size.width(), size.height()))); 72 SkImageInfo::MakeN32Premul(size.width(), size.height())));
74 } 73 }
75 74
76 } // namespace cc 75 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698