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

Side by Side Diff: gm/image.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 Created 4 years, 9 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 | « gm/discard.cpp ('k') | gm/imagefiltersclipped.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 <functional> 8 #include <functional>
9 #include "gm.h" 9 #include "gm.h"
10 #include "SkAutoPixmapStorage.h" 10 #include "SkAutoPixmapStorage.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 // since we've drawn after we snapped imgR, imgG will be a different obj 70 // since we've drawn after we snapped imgR, imgG will be a different obj
71 SkASSERT(imgR != imgG); 71 SkASSERT(imgR != imgG);
72 72
73 drawContents(surf, SK_ColorBLUE); 73 drawContents(surf, SK_ColorBLUE);
74 74
75 SkPaint paint; 75 SkPaint paint;
76 // paint.setFilterBitmap(true); 76 // paint.setFilterBitmap(true);
77 // paint.setAlpha(0x80); 77 // paint.setAlpha(0x80);
78 78
79 canvas->drawImage(imgR.get(), 0, 0, usePaint ? &paint : nullptr); 79 canvas->drawImage(imgR, 0, 0, usePaint ? &paint : nullptr);
80 canvas->drawImage(imgG.get(), 0, 80, usePaint ? &paint : nullptr); 80 canvas->drawImage(imgG, 0, 80, usePaint ? &paint : nullptr);
81 surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr); 81 surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr);
82 82
83 SkRect src1, src2, src3; 83 SkRect src1, src2, src3;
84 src1.iset(0, 0, surf->width(), surf->height()); 84 src1.iset(0, 0, surf->width(), surf->height());
85 src2.iset(-surf->width() / 2, -surf->height() / 2, 85 src2.iset(-surf->width() / 2, -surf->height() / 2,
86 surf->width(), surf->height()); 86 surf->width(), surf->height());
87 src3.iset(0, 0, surf->width() / 2, surf->height() / 2); 87 src3.iset(0, 0, surf->width() / 2, surf->height() / 2);
88 88
89 SkRect dst1, dst2, dst3, dst4; 89 SkRect dst1, dst2, dst3, dst4;
90 dst1.set(0, 240, 65, 305); 90 dst1.set(0, 240, 65, 305);
91 dst2.set(0, 320, 65, 385); 91 dst2.set(0, 320, 65, 385);
92 dst3.set(0, 400, 65, 465); 92 dst3.set(0, 400, 65, 465);
93 dst4.set(0, 480, 65, 545); 93 dst4.set(0, 480, 65, 545);
94 94
95 canvas->drawImageRect(imgR.get(), src1, dst1, usePaint ? &paint : nullptr); 95 canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : nullptr);
96 canvas->drawImageRect(imgG.get(), src2, dst2, usePaint ? &paint : nullptr); 96 canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : nullptr);
97 canvas->drawImageRect(imgR.get(), src3, dst3, usePaint ? &paint : nullptr); 97 canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : nullptr);
98 canvas->drawImageRect(imgG.get(), dst4, usePaint ? &paint : nullptr); 98 canvas->drawImageRect(imgG, dst4, usePaint ? &paint : nullptr);
99 } 99 }
100 100
101 class ImageGM : public skiagm::GM { 101 class ImageGM : public skiagm::GM {
102 void* fBuffer; 102 void* fBuffer;
103 size_t fBufferSize; 103 size_t fBufferSize;
104 SkSize fSize; 104 SkSize fSize;
105 enum { 105 enum {
106 W = 64, 106 W = 64,
107 H = 64, 107 H = 64,
108 RB = W * 4 + 8, 108 RB = W * 4 + 8,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 500 }
501 if (context) { 501 if (context) {
502 sk_sp<SkImage> texImage(image->makeTextureImage(context)); 502 sk_sp<SkImage> texImage(image->makeTextureImage(context));
503 if (texImage) { 503 if (texImage) {
504 canvas->drawImage(texImage, 0, 0); 504 canvas->drawImage(texImage, 0, 0);
505 } 505 }
506 } 506 }
507 canvas->translate(image->width() + kPad, 0); 507 canvas->translate(image->width() + kPad, 0);
508 } 508 }
509 } 509 }
OLDNEW
« no previous file with comments | « gm/discard.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698