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

Side by Side Diff: samplecode/SampleTinyBitmap.cpp

Issue 66723017: Remove deprecated setIsOpaque() API from SkBitmap. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 1 month 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 | « include/core/SkBitmap.h ('k') | no next file » | 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkShader.h" 10 #include "SkShader.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 if (SampleCode::TitleQ(*evt)) { 51 if (SampleCode::TitleQ(*evt)) {
52 SampleCode::TitleR(evt, "TinyBitmap"); 52 SampleCode::TitleR(evt, "TinyBitmap");
53 return true; 53 return true;
54 } 54 }
55 return this->INHERITED::onQuery(evt); 55 return this->INHERITED::onQuery(evt);
56 } 56 }
57 57
58 static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) { 58 static void setBitmapOpaque(SkBitmap* bm, bool isOpaque) {
59 SkAutoLockPixels alp(*bm); // needed for ctable 59 SkAutoLockPixels alp(*bm); // needed for ctable
60 bm->setAlphaType(isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); 60 bm->setAlphaType(isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
61 #if 0
62 SkColorTable* ctable = bm->getColorTable();
63 if (ctable) {
64 ctable->setIsOpaque(isOpaque);
65 }
66 #endif
67 } 61 }
68 62
69 virtual void onDrawContent(SkCanvas* canvas) { 63 virtual void onDrawContent(SkCanvas* canvas) {
70 SkShader* s = SkShader::CreateBitmapShader(fBM, SkShader::kRepeat_TileMo de, 64 SkShader* s = SkShader::CreateBitmapShader(fBM, SkShader::kRepeat_TileMo de,
71 SkShader::kMirror_TileMode); 65 SkShader::kMirror_TileMode);
72 SkPaint paint; 66 SkPaint paint;
73 paint.setShader(s)->unref(); 67 paint.setShader(s)->unref();
74 canvas->drawPaint(paint); 68 canvas->drawPaint(paint);
75 } 69 }
76 70
77 private: 71 private:
78 typedef SkView INHERITED; 72 typedef SkView INHERITED;
79 }; 73 };
80 74
81 ////////////////////////////////////////////////////////////////////////////// 75 //////////////////////////////////////////////////////////////////////////////
82 76
83 static SkView* MyFactory() { return new TinyBitmapView; } 77 static SkView* MyFactory() { return new TinyBitmapView; }
84 static SkViewRegister reg(MyFactory); 78 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698