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

Side by Side Diff: gm/tinybitmap.cpp

Issue 26572006: Revert "Revert "change SkColorTable to be immutable"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « bench/RepeatTileBench.cpp ('k') | include/core/SkAlpha.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "gm.h" 8 #include "gm.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkUtils.h" 12 #include "SkUtils.h"
13 13
14 namespace skiagm { 14 namespace skiagm {
15 15
16 static SkBitmap make_bitmap() { 16 static SkBitmap make_bitmap() {
17 const SkPMColor c[] = { SkPackARGB32(0x80, 0x80, 0, 0) };
18 SkColorTable* ctable = new SkColorTable(c, SK_ARRAY_COUNT(c));
19
17 SkBitmap bm; 20 SkBitmap bm;
18
19 SkColorTable* ctable = new SkColorTable(1);
20 SkPMColor* c = ctable->lockColors();
21 c[0] = SkPackARGB32(0x80, 0x80, 0, 0);
22 ctable->unlockColors(true);
23
24 bm.setConfig(SkBitmap::kIndex8_Config, 1, 1); 21 bm.setConfig(SkBitmap::kIndex8_Config, 1, 1);
25 bm.allocPixels(ctable); 22 bm.allocPixels(ctable);
26 ctable->unref(); 23 ctable->unref();
27 24
28 bm.lockPixels(); 25 bm.lockPixels();
29 *bm.getAddr8(0, 0) = 0; 26 *bm.getAddr8(0, 0) = 0;
30 bm.unlockPixels(); 27 bm.unlockPixels();
31 return bm; 28 return bm;
32 } 29 }
33 30
(...skipping 24 matching lines...) Expand all
58 private: 55 private:
59 typedef GM INHERITED; 56 typedef GM INHERITED;
60 }; 57 };
61 58
62 ////////////////////////////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////////////////////////////
63 60
64 static GM* MyFactory(void*) { return new TinyBitmapGM; } 61 static GM* MyFactory(void*) { return new TinyBitmapGM; }
65 static GMRegistry reg(MyFactory); 62 static GMRegistry reg(MyFactory);
66 63
67 } 64 }
OLDNEW
« no previous file with comments | « bench/RepeatTileBench.cpp ('k') | include/core/SkAlpha.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698