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

Side by Side Diff: gm/SkLinearBitmapPipelineGM.cpp

Issue 1871173002: Add constant for blitter context size. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add constants. Created 4 years, 8 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 | « bench/SkLinearBitmapPipelineBench.cpp ('k') | src/core/SkBitmapProcShader.h » ('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 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 "gm.h" 8 #include "gm.h"
9 #include "SkBlitter.h" 9 #include "SkBlitter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkColor.h" 11 #include "SkColor.h"
12 #include "SkImage.h" 12 #include "SkImage.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkLinearBitmapPipeline.h" 14 #include "SkLinearBitmapPipeline.h"
15 #include "SkXfermode.h" 15 #include "SkXfermode.h"
16 #include "SkPM4fPriv.h" 16 #include "SkPM4fPriv.h"
17 #include "SkShader.h" 17 #include "SkShader.h"
18 #include "SkBitmapProcShader.h"
18 19
19 static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) { 20 static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) {
20 bm.allocN32Pixels(ir.width(), ir.height()); 21 bm.allocN32Pixels(ir.width(), ir.height());
21 SkPixmap pm; 22 SkPixmap pm;
22 bm.peekPixels(&pm); 23 bm.peekPixels(&pm);
23 24
24 SkPMColor b = SkColorSetARGBMacro(255, 0, 0, 0); 25 SkPMColor b = SkColorSetARGBMacro(255, 0, 0, 0);
25 SkPMColor w; 26 SkPMColor w;
26 if (premul) { 27 if (premul) {
27 w = SkPreMultiplyColor(c); 28 w = SkPreMultiplyColor(c);
(...skipping 24 matching lines...) Expand all
52 SkBitmap bmdst; 53 SkBitmap bmdst;
53 bmdst.allocN32Pixels(ir.width(), ir.height()); 54 bmdst.allocN32Pixels(ir.width(), ir.height());
54 bmdst.eraseColor(0xFFFFFFFF); 55 bmdst.eraseColor(0xFFFFFFFF);
55 SkPixmap pmdst; 56 SkPixmap pmdst;
56 bmdst.peekPixels(&pmdst); 57 bmdst.peekPixels(&pmdst);
57 58
58 SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLine ar_SkColorProfileType); 59 SkImageInfo info = SkImageInfo::MakeN32Premul(ir.width(), ir.height(), kLine ar_SkColorProfileType);
59 60
60 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes()))); 61 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes())));
61 SkPaint paint; 62 SkPaint paint;
62 int32_t storage[400]; 63 int32_t storage[kSkBlitterContextSize];
63 64
64 sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode, 65 sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode,
65 SkShader::kRepeat_TileMode); 66 SkShader::kRepeat_TileMode);
66 67
67 if (useBilerp) { 68 if (useBilerp) {
68 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); 69 paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
69 } else { 70 } else {
70 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality); 71 paint.setFilterQuality(SkFilterQuality::kNone_SkFilterQuality);
71 } 72 }
72 paint.setShader(std::move(shader)); 73 paint.setShader(std::move(shader));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 196 }
196 canvas->restore(); 197 canvas->restore();
197 canvas->translate(0, H + 20); 198 canvas->translate(0, H + 20);
198 } 199 }
199 canvas->restore(); 200 canvas->restore();
200 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats)); 201 canvas->translate(0, (H + 20) * SK_ARRAY_COUNT(mats));
201 if (useBilerp) break; 202 if (useBilerp) break;
202 useBilerp = true; 203 useBilerp = true;
203 } 204 }
204 } 205 }
OLDNEW
« no previous file with comments | « bench/SkLinearBitmapPipelineBench.cpp ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698