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

Side by Side Diff: gm/peekpixels.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/pathreverse.cpp ('k') | gm/picture.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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 13
14 static void draw_content(SkCanvas* canvas) { 14 static void draw_content(SkCanvas* canvas) {
15 SkImageInfo info = canvas->imageInfo(); 15 SkImageInfo info = canvas->imageInfo();
16 SkPaint paint; 16 SkPaint paint;
17 paint.setAntiAlias(true); 17 paint.setAntiAlias(true);
18 canvas->drawCircle(SkScalarHalf(info.width()), SkScalarHalf(info.height()), 18 canvas->drawCircle(SkScalarHalf(info.width()), SkScalarHalf(info.height()),
19 SkScalarHalf(info.width()), paint); 19 SkScalarHalf(info.width()), paint);
20 } 20 }
21 21
22 class PeekPixelsGM : public skiagm::GM { 22 class PeekPixelsGM : public skiagm::GM {
23 public: 23 public:
24 PeekPixelsGM() {} 24 PeekPixelsGM() {}
25 25
26 protected: 26 protected:
27 virtual SkString onShortName() SK_OVERRIDE { 27 SkString onShortName() SK_OVERRIDE {
28 return SkString("peekpixels"); 28 return SkString("peekpixels");
29 } 29 }
30 30
31 virtual SkISize onISize() SK_OVERRIDE { 31 SkISize onISize() SK_OVERRIDE {
32 return SkISize::Make(360, 120); 32 return SkISize::Make(360, 120);
33 } 33 }
34 34
35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 35 void onDraw(SkCanvas* canvas) SK_OVERRIDE {
36 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); 36 SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
37 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); 37 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
38 if (surface.get()) { 38 if (surface.get()) {
39 SkCanvas* surfCanvas = surface->getCanvas(); 39 SkCanvas* surfCanvas = surface->getCanvas();
40 40
41 draw_content(surfCanvas); 41 draw_content(surfCanvas);
42 SkBitmap bitmap; 42 SkBitmap bitmap;
43 43
44 // test peekPixels 44 // test peekPixels
45 { 45 {
(...skipping 11 matching lines...) Expand all
57 if (ropixels.asROBitmap(&bitmap)) { 57 if (ropixels.asROBitmap(&bitmap)) {
58 canvas->drawBitmap(bitmap, 0, 0, NULL); 58 canvas->drawBitmap(bitmap, 0, 0, NULL);
59 } 59 }
60 60
61 // test Surface 61 // test Surface
62 canvas->translate(120, 0); 62 canvas->translate(120, 0);
63 surface->draw(canvas, 0, 0, NULL); 63 surface->draw(canvas, 0, 0, NULL);
64 } 64 }
65 } 65 }
66 66
67 virtual uint32_t onGetFlags() const SK_OVERRIDE { 67 uint32_t onGetFlags() const SK_OVERRIDE {
68 // we explicitly test peekPixels and readPixels, neither of which 68 // we explicitly test peekPixels and readPixels, neither of which
69 // return something for a picture-backed canvas, so we skip that test. 69 // return something for a picture-backed canvas, so we skip that test.
70 return kSkipPicture_Flag; 70 return kSkipPicture_Flag;
71 } 71 }
72 72
73 private: 73 private:
74 typedef skiagm::GM INHERITED; 74 typedef skiagm::GM INHERITED;
75 }; 75 };
76 76
77 DEF_GM( return SkNEW(PeekPixelsGM); ) 77 DEF_GM( return SkNEW(PeekPixelsGM); )
OLDNEW
« no previous file with comments | « gm/pathreverse.cpp ('k') | gm/picture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698