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

Side by Side Diff: tests/SpecialImageTest.cpp

Issue 1704603002: Change signature of SkSpecialImage::draw to take SkScalars (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « src/core/SkSpecialSurface.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file 5 * found in the LICENSE file
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 //-------------- 83 //--------------
84 SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_SkAlph aType); 84 SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_SkAlph aType);
85 85
86 SkAutoTUnref<SkSpecialSurface> surf(img->newSurface(info)); 86 SkAutoTUnref<SkSpecialSurface> surf(img->newSurface(info));
87 87
88 SkCanvas* canvas = surf->getCanvas(); 88 SkCanvas* canvas = surf->getCanvas();
89 89
90 canvas->clear(SK_ColorBLUE); 90 canvas->clear(SK_ColorBLUE);
91 img->draw(canvas, kPad, kPad, nullptr); 91 img->draw(canvas, SkIntToScalar(kPad), SkIntToScalar(kPad), nullptr);
92 92
93 SkBitmap bm; 93 SkBitmap bm;
94 bm.allocN32Pixels(kFullSize, kFullSize, true); 94 bm.allocN32Pixels(kFullSize, kFullSize, true);
95 95
96 bool result = canvas->readPixels(bm.info(), bm.getPixels(), bm.rowBytes(), 0 , 0); 96 bool result = canvas->readPixels(bm.info(), bm.getPixels(), bm.rowBytes(), 0 , 0);
97 SkASSERT_RELEASE(result); 97 SkASSERT_RELEASE(result);
98 98
99 // Only the center (red) portion should've been drawn into the canvas 99 // Only the center (red) portion should've been drawn into the canvas
100 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kPad-1, kPad-1)); 100 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kPad-1, kPad-1));
101 REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kPad, kPad)); 101 REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kPad, kPad));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return; 141 return;
142 } 142 }
143 143
144 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size); 144 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size);
145 145
146 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(subset, texture) ); 146 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(subset, texture) );
147 test_image(img, reporter, false, true); 147 test_image(img, reporter, false, true);
148 } 148 }
149 149
150 #endif 150 #endif
OLDNEW
« no previous file with comments | « src/core/SkSpecialSurface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698