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

Side by Side Diff: tests/PremulAlphaRoundTripTest.cpp

Issue 536003002: Hide fields in SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix qt Created 6 years, 3 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 | « tests/DrawBitmapRectTest.cpp ('k') | tests/RecordReplaceDrawTest.cpp » ('j') | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 SkBitmap bmp; 51 SkBitmap bmp;
52 bmp.allocN32Pixels(256, 256); 52 bmp.allocN32Pixels(256, 256);
53 53
54 for (int a = 0; a < 256; ++a) { 54 for (int a = 0; a < 256; ++a) {
55 uint32_t* pixels = bmp.getAddr32(0, a); 55 uint32_t* pixels = bmp.getAddr32(0, a);
56 for (int r = 0; r < 256; ++r) { 56 for (int r = 0; r < 256; ++r) {
57 pixels[r] = proc(SkColorSetARGB(a, r, 0, 0)); 57 pixels[r] = proc(SkColorSetARGB(a, r, 0, 0));
58 } 58 }
59 } 59 }
60 60
61 SkImageInfo info = bmp.info(); 61 const SkImageInfo info = SkImageInfo::Make(bmp.width(), bmp.height(),
62 info.fColorType = colorType; 62 colorType, kUnpremul_SkAlphaType) ;
63 info.fAlphaType = kUnpremul_SkAlphaType;
64 canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0); 63 canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0);
65 } 64 }
66 65
67 DEF_GPUTEST(PremulAlphaRoundTrip, reporter, factory) { 66 DEF_GPUTEST(PremulAlphaRoundTrip, reporter, factory) {
68 const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256); 67 const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
69 68
70 for (int dtype = 0; dtype < 2; ++dtype) { 69 for (int dtype = 0; dtype < 2; ++dtype) {
71 70
72 int glCtxTypeCnt = 1; 71 int glCtxTypeCnt = 1;
73 #if SK_SUPPORT_GPU 72 #if SK_SUPPORT_GPU
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (pixels1[x] != pixels2[x]) { 124 if (pixels1[x] != pixels2[x]) {
126 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p ixels2[x], x, y); 125 SkDebugf("%x != %x, x = %d, y = %d\n", pixels1[x], p ixels2[x], x, y);
127 } 126 }
128 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels 2[x]); 127 REPORTER_ASSERT(reporter, success = pixels1[x] == pixels 2[x]);
129 } 128 }
130 } 129 }
131 } 130 }
132 } 131 }
133 } 132 }
134 } 133 }
OLDNEW
« no previous file with comments | « tests/DrawBitmapRectTest.cpp ('k') | tests/RecordReplaceDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698