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

Side by Side Diff: gm/imagefromyuvtextures.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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 | « gm/imagefilterstransformed.cpp ('k') | gm/imagemagnifier.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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 23 matching lines...) Expand all
34 return SkISize::Make(50, 135); 34 return SkISize::Make(50, 135);
35 } 35 }
36 36
37 void onOnceBeforeDraw() override { 37 void onOnceBeforeDraw() override {
38 // We create an RGB bitmap and then extract YUV bmps where the U and V b itmaps are 38 // We create an RGB bitmap and then extract YUV bmps where the U and V b itmaps are
39 // subsampled by 2 in both dimensions. 39 // subsampled by 2 in both dimensions.
40 SkPaint paint; 40 SkPaint paint;
41 static const SkColor kColors[] = 41 static const SkColor kColors[] =
42 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE }; 42 { SK_ColorBLUE, SK_ColorYELLOW, SK_ColorGREEN, SK_ColorWHITE };
43 paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), kBmpS ize / 2.f, kColors, 43 paint.setShader(SkGradientShader::CreateRadial(SkPoint::Make(0,0), kBmpS ize / 2.f, kColors,
44 NULL, SK_ARRAY_COUNT(kCol ors), 44 nullptr, SK_ARRAY_COUNT(k Colors),
45 SkShader::kMirror_TileMod e))->unref(); 45 SkShader::kMirror_TileMod e))->unref();
46 SkBitmap rgbBmp; 46 SkBitmap rgbBmp;
47 rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true); 47 rgbBmp.allocN32Pixels(kBmpSize, kBmpSize, true);
48 SkCanvas canvas(rgbBmp); 48 SkCanvas canvas(rgbBmp);
49 canvas.drawPaint(paint); 49 canvas.drawPaint(paint);
50 SkPMColor* rgbColors = static_cast<SkPMColor*>(rgbBmp.getPixels()); 50 SkPMColor* rgbColors = static_cast<SkPMColor*>(rgbBmp.getPixels());
51 51
52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize); 52 SkImageInfo yinfo = SkImageInfo::MakeA8(kBmpSize, kBmpSize);
53 fYUVBmps[0].allocPixels(yinfo); 53 fYUVBmps[0].allocPixels(yinfo);
54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2); 54 SkImageInfo uinfo = SkImageInfo::MakeA8(kBmpSize / 2, kBmpSize / 2);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 yuvIDs, sizes, 149 yuvIDs, sizes,
150 kTopLeft_GrSurfaceO rigin)); 150 kTopLeft_GrSurfaceO rigin));
151 } 151 }
152 this->deleteYUVTextures(context, yuvIDs); 152 this->deleteYUVTextures(context, yuvIDs);
153 for (int i = 0; i < images.count(); ++ i) { 153 for (int i = 0; i < images.count(); ++ i) {
154 SkScalar y = (i + 1) * kPad + i * fYUVBmps[0].height(); 154 SkScalar y = (i + 1) * kPad + i * fYUVBmps[0].height();
155 SkScalar x = kPad; 155 SkScalar x = kPad;
156 156
157 canvas->drawImage(images[i], x, y); 157 canvas->drawImage(images[i], x, y);
158 images[i]->unref(); 158 images[i]->unref();
159 images[i] = NULL; 159 images[i] = nullptr;
160 } 160 }
161 } 161 }
162 162
163 private: 163 private:
164 SkAutoTUnref<SkImage> fRGBImage; 164 SkAutoTUnref<SkImage> fRGBImage;
165 SkBitmap fYUVBmps[3]; 165 SkBitmap fYUVBmps[3];
166 166
167 static const int kBmpSize = 32; 167 static const int kBmpSize = 32;
168 168
169 typedef GM INHERITED; 169 typedef GM INHERITED;
170 }; 170 };
171 171
172 DEF_GM(return new ImageFromYUVTextures;) 172 DEF_GM(return new ImageFromYUVTextures;)
173 } 173 }
174 174
175 #endif 175 #endif
OLDNEW
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | gm/imagemagnifier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698