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

Side by Side Diff: gm/blurquickreject.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: hide constant Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(blurRects)); 49 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(blurRects));
50 50
51 SkPaint hairlinePaint; 51 SkPaint hairlinePaint;
52 hairlinePaint.setStyle(SkPaint::kStroke_Style); 52 hairlinePaint.setStyle(SkPaint::kStroke_Style);
53 hairlinePaint.setColor(SK_ColorWHITE); 53 hairlinePaint.setColor(SK_ColorWHITE);
54 hairlinePaint.setStrokeWidth(0); 54 hairlinePaint.setStrokeWidth(0);
55 55
56 SkPaint blurPaint; 56 SkPaint blurPaint;
57 blurPaint.setFilterBitmap(true); 57 blurPaint.setFilterBitmap(true);
58 SkMaskFilter* mf = SkBlurMaskFilter::Create(kBlurRadius, 58 SkMaskFilter* mf = SkBlurMaskFilter::Create(kBlurRadius,
59 SkBlurMaskFilter::kNormal_Bl urStyle); 59 SkBlurMaskFilter::kNormal_Bl urStyle,
60 SkBlurMaskFilter::kNone_Blur Flag);
60 blurPaint.setMaskFilter(mf)->unref(); 61 blurPaint.setMaskFilter(mf)->unref();
61 62
62 canvas->clear(SK_ColorBLACK); 63 canvas->clear(SK_ColorBLACK);
63 canvas->save(); 64 canvas->save();
64 canvas->translate(kBoxSize, kBoxSize); 65 canvas->translate(kBoxSize, kBoxSize);
65 canvas->drawRect(clipRect, hairlinePaint); 66 canvas->drawRect(clipRect, hairlinePaint);
66 canvas->clipRect(clipRect); 67 canvas->clipRect(clipRect);
67 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) { 68 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRects); ++i) {
68 blurPaint.setColor(colors[i]); 69 blurPaint.setColor(colors[i]);
69 canvas->drawRect(blurRects[i], blurPaint); 70 canvas->drawRect(blurRects[i], blurPaint);
70 canvas->drawRect(blurRects[i], hairlinePaint); 71 canvas->drawRect(blurRects[i], hairlinePaint);
71 } 72 }
72 canvas->restore(); 73 canvas->restore();
73 } 74 }
74 75
75 private: 76 private:
76 static const int kWidth = 300; 77 static const int kWidth = 300;
77 static const int kHeight = 300; 78 static const int kHeight = 300;
78 79
79 typedef GM INHERITED; 80 typedef GM INHERITED;
80 }; 81 };
81 82
82 DEF_GM( return new BlurQuickRejectGM(); ) 83 DEF_GM( return new BlurQuickRejectGM(); )
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | gm/blurrect.cpp » ('j') | include/effects/SkBlurDrawLooper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698