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

Side by Side Diff: bench/BitmapRectBench.cpp

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 protected: 59 protected:
60 virtual const char* onGetName() SK_OVERRIDE { 60 virtual const char* onGetName() SK_OVERRIDE {
61 fName.printf("bitmaprect_%02X_%sfilter_%s", 61 fName.printf("bitmaprect_%02X_%sfilter_%s",
62 fAlpha, fDoFilter ? "" : "no", 62 fAlpha, fDoFilter ? "" : "no",
63 fSlightMatrix ? "trans" : "identity"); 63 fSlightMatrix ? "trans" : "identity");
64 return fName.c_str(); 64 return fName.c_str();
65 } 65 }
66 66
67 virtual void onPreDraw() SK_OVERRIDE { 67 virtual void onPreDraw() SK_OVERRIDE {
68 fBitmap.allocPixels(); 68 fBitmap.allocPixels();
69 fBitmap.setIsOpaque(true); 69 fBitmap.setAlphaType(kOpaque_SkAlphaType);
70 fBitmap.eraseColor(SK_ColorBLACK); 70 fBitmap.eraseColor(SK_ColorBLACK);
71 draw_into_bitmap(fBitmap); 71 draw_into_bitmap(fBitmap);
72 72
73 fSrcR.iset(0, 0, kWidth, kHeight); 73 fSrcR.iset(0, 0, kWidth, kHeight);
74 fDstR.iset(0, 0, kWidth, kHeight); 74 fDstR.iset(0, 0, kWidth, kHeight);
75 75
76 if (fSlightMatrix) { 76 if (fSlightMatrix) {
77 // want fractional translate 77 // want fractional translate
78 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7); 78 fDstR.offset(SK_Scalar1 / 3, SK_Scalar1 * 5 / 7);
79 // want enough to create a scale matrix, but not enough to scare 79 // want enough to create a scale matrix, but not enough to scare
(...skipping 21 matching lines...) Expand all
101 typedef SkBenchmark INHERITED; 101 typedef SkBenchmark INHERITED;
102 }; 102 };
103 103
104 DEF_BENCH(return new BitmapRectBench(0xFF, false, false)) 104 DEF_BENCH(return new BitmapRectBench(0xFF, false, false))
105 DEF_BENCH(return new BitmapRectBench(0x80, false, false)) 105 DEF_BENCH(return new BitmapRectBench(0x80, false, false))
106 DEF_BENCH(return new BitmapRectBench(0xFF, true, false)) 106 DEF_BENCH(return new BitmapRectBench(0xFF, true, false))
107 DEF_BENCH(return new BitmapRectBench(0x80, true, false)) 107 DEF_BENCH(return new BitmapRectBench(0x80, true, false))
108 108
109 DEF_BENCH(return new BitmapRectBench(0xFF, false, true)) 109 DEF_BENCH(return new BitmapRectBench(0xFF, false, true))
110 DEF_BENCH(return new BitmapRectBench(0xFF, true, true)) 110 DEF_BENCH(return new BitmapRectBench(0xFF, true, true))
OLDNEW
« no previous file with comments | « bench/BitmapBench.cpp ('k') | bench/BitmapScaleBench.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698