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

Side by Side Diff: samplecode/SampleAll.cpp

Issue 1812323003: Remove uses of SkImageDecoder from samplecode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « samplecode/DecodeFile.h ('k') | samplecode/SampleBitmapRect.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 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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkView.h" 11 #include "SkView.h"
12 #include "Sk1DPathEffect.h" 12 #include "Sk1DPathEffect.h"
13 #include "Sk2DPathEffect.h" 13 #include "Sk2DPathEffect.h"
14 #include "SkBlurMaskFilter.h" 14 #include "SkBlurMaskFilter.h"
15 #include "SkColorMatrixFilter.h" 15 #include "SkColorMatrixFilter.h"
16 #include "SkColorPriv.h" 16 #include "SkColorPriv.h"
17 #include "SkCornerPathEffect.h" 17 #include "SkCornerPathEffect.h"
18 #include "SkDashPathEffect.h" 18 #include "SkDashPathEffect.h"
19 #include "SkDiscretePathEffect.h" 19 #include "SkDiscretePathEffect.h"
20 #include "SkEmbossMaskFilter.h" 20 #include "SkEmbossMaskFilter.h"
21 #include "SkReadBuffer.h" 21 #include "SkReadBuffer.h"
22 #include "SkWriteBuffer.h" 22 #include "SkWriteBuffer.h"
23 #include "SkGradientShader.h" 23 #include "SkGradientShader.h"
24 #include "SkImageDecoder.h"
25 #include "SkLayerRasterizer.h" 24 #include "SkLayerRasterizer.h"
26 #include "SkMath.h" 25 #include "SkMath.h"
27 #include "SkPath.h" 26 #include "SkPath.h"
28 #include "SkPictureRecorder.h" 27 #include "SkPictureRecorder.h"
29 #include "SkRegion.h" 28 #include "SkRegion.h"
30 #include "SkShader.h" 29 #include "SkShader.h"
31 #include "SkCornerPathEffect.h" 30 #include "SkCornerPathEffect.h"
32 #include "SkPathMeasure.h" 31 #include "SkPathMeasure.h"
33 #include "SkPicture.h" 32 #include "SkPicture.h"
34 #include "SkRandom.h" 33 #include "SkRandom.h"
35 #include "SkTypeface.h" 34 #include "SkTypeface.h"
36 #include "SkUtils.h" 35 #include "SkUtils.h"
37 #include "SkXfermode.h" 36 #include "SkXfermode.h"
38 37
39 #include <math.h> 38 #include <math.h>
39 #include "DecodeFile.h"
40 40
41 static inline SkPMColor rgb2gray(SkPMColor c) { 41 static inline SkPMColor rgb2gray(SkPMColor c) {
42 unsigned r = SkGetPackedR32(c); 42 unsigned r = SkGetPackedR32(c);
43 unsigned g = SkGetPackedG32(c); 43 unsigned g = SkGetPackedG32(c);
44 unsigned b = SkGetPackedB32(c); 44 unsigned b = SkGetPackedB32(c);
45 45
46 unsigned x = (r * 5 + g * 7 + b * 4) >> 4; 46 unsigned x = (r * 5 + g * 7 + b * 4) >> 4;
47 47
48 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT)); 48 return SkPackARGB32(0, x, x, x) | (c & (SK_A32_MASK << SK_A32_SHIFT));
49 } 49 }
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 2, SkShader::kClamp_TileMode); 504 2, SkShader::kClamp_TileMode);
505 pts[1].set(0, SkIntToScalar(100)); 505 pts[1].set(0, SkIntToScalar(100));
506 SkColor colors2[] = {SK_ColorBLACK, SkColorSetARGB(0x80, 0, 0, 0)}; 506 SkColor colors2[] = {SK_ColorBLACK, SkColorSetARGB(0x80, 0, 0, 0)};
507 auto shaderB = SkGradientShader::MakeLinear(pts, colors2, nullptr, 507 auto shaderB = SkGradientShader::MakeLinear(pts, colors2, nullptr,
508 2, SkShader::kClamp_TileMode); 508 2, SkShader::kClamp_TileMode);
509 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kDstIn_Mode )); 509 SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kDstIn_Mode ));
510 return SkShader::MakeComposeShader(shaderA, shaderB, mode); 510 return SkShader::MakeComposeShader(shaderA, shaderB, mode);
511 } 511 }
512 512
513 virtual void startTest() { 513 virtual void startTest() {
514 SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/bugcirc.gif", &fBug ); 514 decode_file("/Users/caryclark/Desktop/bugcirc.gif", &fBug);
515 SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/tbcirc.gif", &fTb); 515 decode_file("/Users/caryclark/Desktop/tbcirc.gif", &fTb);
516 SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/05psp04.gif", &fTx) ; 516 decode_file("/Users/caryclark/Desktop/05psp04.gif", &fTx);
517 } 517 }
518 518
519 void drawRaster(SkCanvas* canvas) { 519 void drawRaster(SkCanvas* canvas) {
520 for (size_t index = 0; index < SK_ARRAY_COUNT(gRastProcs); index++) 520 for (size_t index = 0; index < SK_ARRAY_COUNT(gRastProcs); index++)
521 drawOneRaster(canvas); 521 drawOneRaster(canvas);
522 } 522 }
523 523
524 void drawOneRaster(SkCanvas* canvas) { 524 void drawOneRaster(SkCanvas* canvas) {
525 canvas->save(); 525 canvas->save();
526 526
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 private: 563 private:
564 SkPoint fClickPt; 564 SkPoint fClickPt;
565 SkBitmap fBug, fTb, fTx; 565 SkBitmap fBug, fTb, fTx;
566 typedef SampleView INHERITED; 566 typedef SampleView INHERITED;
567 }; 567 };
568 568
569 ////////////////////////////////////////////////////////////////////////////// 569 //////////////////////////////////////////////////////////////////////////////
570 570
571 static SkView* MyFactory() { return new DemoView; } 571 static SkView* MyFactory() { return new DemoView; }
572 static SkViewRegister reg(MyFactory); 572 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/DecodeFile.h ('k') | samplecode/SampleBitmapRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698