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

Side by Side Diff: cc/playback/image_hijack_canvas_unittest.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "cc/playback/image_hijack_canvas.h" 4 #include "cc/playback/image_hijack_canvas.h"
5 5
6 #include "cc/tiles/image_decode_cache.h" 6 #include "cc/tiles/image_decode_cache.h"
7 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "third_party/skia/include/core/SkImage.h" 10 #include "third_party/skia/include/core/SkImage.h"
(...skipping 26 matching lines...) Expand all
37 // will hit an error. 37 // will hit an error.
38 testing::StrictMock<MockImageDecodeCache> image_decode_cache; 38 testing::StrictMock<MockImageDecodeCache> image_decode_cache;
39 ImageHijackCanvas canvas(100, 100, &image_decode_cache); 39 ImageHijackCanvas canvas(100, 100, &image_decode_cache);
40 40
41 // Use an SkBitmap backed image to ensure that the image is not 41 // Use an SkBitmap backed image to ensure that the image is not
42 // lazy-generated. 42 // lazy-generated.
43 SkBitmap bitmap; 43 SkBitmap bitmap;
44 bitmap.allocN32Pixels(10, 10, true); 44 bitmap.allocN32Pixels(10, 10, true);
45 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap); 45 sk_sp<SkImage> image = SkImage::MakeFromBitmap(bitmap);
46 46
47 SkPaint paint; 47 PaintFlags paint;
48 canvas.drawImage(image, 0, 0, &paint); 48 canvas.drawImage(image, 0, 0, &paint);
49 canvas.drawImageRect(image, SkRect::MakeXYWH(0, 0, 10, 10), 49 canvas.drawImageRect(image, SkRect::MakeXYWH(0, 0, 10, 10),
50 SkRect::MakeXYWH(10, 10, 10, 10), &paint); 50 SkRect::MakeXYWH(10, 10, 10, 10), &paint);
51 51
52 SkPaint image_paint; 52 PaintFlags image_paint;
53 image_paint.setShader( 53 image_paint.setShader(
54 image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode)); 54 image->makeShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode));
55 SkRect paint_rect = SkRect::MakeXYWH(0, 0, 100, 100); 55 SkRect paint_rect = SkRect::MakeXYWH(0, 0, 100, 100);
56 canvas.drawRect(paint_rect, image_paint); 56 canvas.drawRect(paint_rect, image_paint);
57 SkPath path; 57 SkPath path;
58 path.addRect(paint_rect, SkPath::kCW_Direction); 58 path.addRect(paint_rect, SkPath::kCW_Direction);
59 canvas.drawPath(path, image_paint); 59 canvas.drawPath(path, image_paint);
60 canvas.drawOval(paint_rect, image_paint); 60 canvas.drawOval(paint_rect, image_paint);
61 canvas.drawArc(paint_rect, 0, 40, true, image_paint); 61 canvas.drawArc(paint_rect, 0, 40, true, image_paint);
62 canvas.drawRRect(SkRRect::MakeRect(paint_rect), image_paint); 62 canvas.drawRRect(SkRRect::MakeRect(paint_rect), image_paint);
63 } 63 }
64 64
65 } // namespace 65 } // namespace
66 66
67 } // namespace cc 67 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698