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

Side by Side Diff: gm/peekpixels.cpp

Issue 300263005: Revert "Revert of add colortable support to imagegenerator (https://codereview.chromium.org/3044430… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 6 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 | « no previous file | gyp/images.gyp » ('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"
(...skipping 28 matching lines...) Expand all
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 {
46 SkImageInfo info; 46 SkImageInfo info;
47 size_t rowBytes; 47 size_t rowBytes;
48 const void* addr = surfCanvas->peekPixels(&info, &rowBytes); 48 const void* addr = surfCanvas->peekPixels(&info, &rowBytes);
49 if (addr && bitmap.installPixels(info, const_cast<void*>(addr), 49 if (addr && bitmap.installPixels(info, const_cast<void*>(addr), rowBytes)) {
50 rowBytes, NULL, NULL)) {
51 canvas->drawBitmap(bitmap, 0, 0, NULL); 50 canvas->drawBitmap(bitmap, 0, 0, NULL);
52 } 51 }
53 } 52 }
54 53
55 // test ROCanvasPixels 54 // test ROCanvasPixels
56 canvas->translate(120, 0); 55 canvas->translate(120, 0);
57 SkAutoROCanvasPixels ropixels(surfCanvas); 56 SkAutoROCanvasPixels ropixels(surfCanvas);
58 if (ropixels.asROBitmap(&bitmap)) { 57 if (ropixels.asROBitmap(&bitmap)) {
59 canvas->drawBitmap(bitmap, 0, 0, NULL); 58 canvas->drawBitmap(bitmap, 0, 0, NULL);
60 } 59 }
61 60
62 // test Surface 61 // test Surface
63 canvas->translate(120, 0); 62 canvas->translate(120, 0);
64 surface->draw(canvas, 0, 0, NULL); 63 surface->draw(canvas, 0, 0, NULL);
65 } 64 }
66 } 65 }
67 66
68 virtual uint32_t onGetFlags() const { 67 virtual uint32_t onGetFlags() const {
69 // we explicitly test peekPixels and readPixels, neither of which 68 // we explicitly test peekPixels and readPixels, neither of which
70 // 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.
71 return kSkipPicture_Flag; 70 return kSkipPicture_Flag;
72 } 71 }
73 72
74 private: 73 private:
75 typedef skiagm::GM INHERITED; 74 typedef skiagm::GM INHERITED;
76 }; 75 };
77 76
78 DEF_GM( return SkNEW(PeekPixelsGM); ) 77 DEF_GM( return SkNEW(PeekPixelsGM); )
OLDNEW
« no previous file with comments | « no previous file | gyp/images.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698