OLD | NEW |
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 "cc/playback/display_item_list.h" | 9 #include "cc/playback/display_item_list.h" |
10 #include "skia/ext/refptr.h" | 10 #include "skia/ext/refptr.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 SkCanvas canvas(bitmap); | 35 SkCanvas canvas(bitmap); |
36 canvas.clipRect(gfx::RectToSkRect(layer_rect)); | 36 canvas.clipRect(gfx::RectToSkRect(layer_rect)); |
37 list->Raster(&canvas, NULL, gfx::Rect(), 1.0f); | 37 list->Raster(&canvas, NULL, gfx::Rect(), 1.0f); |
38 } | 38 } |
39 | 39 |
40 bool AreDisplayListDrawingResultsSame(const gfx::Rect& layer_rect, | 40 bool AreDisplayListDrawingResultsSame(const gfx::Rect& layer_rect, |
41 scoped_refptr<DisplayItemList> list_a, | 41 scoped_refptr<DisplayItemList> list_a, |
42 scoped_refptr<DisplayItemList> list_b) { | 42 scoped_refptr<DisplayItemList> list_b) { |
43 const size_t pixel_size = 4 * layer_rect.size().GetArea(); | 43 const size_t pixel_size = 4 * layer_rect.size().GetArea(); |
44 | 44 |
45 scoped_ptr<unsigned char[]> pixels_a(new unsigned char[pixel_size]); | 45 std::unique_ptr<unsigned char[]> pixels_a(new unsigned char[pixel_size]); |
46 scoped_ptr<unsigned char[]> pixels_b(new unsigned char[pixel_size]); | 46 std::unique_ptr<unsigned char[]> pixels_b(new unsigned char[pixel_size]); |
47 memset(pixels_a.get(), 0, pixel_size); | 47 memset(pixels_a.get(), 0, pixel_size); |
48 memset(pixels_b.get(), 0, pixel_size); | 48 memset(pixels_b.get(), 0, pixel_size); |
49 DrawDisplayList(pixels_a.get(), layer_rect, list_a); | 49 DrawDisplayList(pixels_a.get(), layer_rect, list_a); |
50 DrawDisplayList(pixels_b.get(), layer_rect, list_b); | 50 DrawDisplayList(pixels_b.get(), layer_rect, list_b); |
51 | 51 |
52 return !memcmp(pixels_a.get(), pixels_b.get(), pixel_size); | 52 return !memcmp(pixels_a.get(), pixels_b.get(), pixel_size); |
53 } | 53 } |
54 | 54 |
55 skia::RefPtr<SkImage> CreateDiscardableImage(const gfx::Size& size) { | 55 skia::RefPtr<SkImage> CreateDiscardableImage(const gfx::Size& size) { |
56 const SkImageInfo info = | 56 const SkImageInfo info = |
57 SkImageInfo::MakeN32Premul(size.width(), size.height()); | 57 SkImageInfo::MakeN32Premul(size.width(), size.height()); |
58 return skia::AdoptRef( | 58 return skia::AdoptRef( |
59 SkImage::NewFromGenerator(new TestImageGenerator(info))); | 59 SkImage::NewFromGenerator(new TestImageGenerator(info))); |
60 } | 60 } |
61 | 61 |
62 } // namespace cc | 62 } // namespace cc |
OLD | NEW |