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

Side by Side Diff: skia/ext/paint_simplifier.cc

Issue 610743002: skia/ext: Removed paint simplifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « skia/ext/paint_simplifier.h ('k') | skia/skia_chrome.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "skia/ext/paint_simplifier.h"
6 #include "third_party/skia/include/core/SkPaint.h"
7 #include "third_party/skia/include/core/SkShader.h"
8
9 namespace skia {
10 namespace {
11
12 bool PaintHasBitmap(const SkPaint &paint) {
13 SkShader* shader = paint.getShader();
14 if (!shader)
15 return false;
16
17 if (shader->asAGradient(NULL) == SkShader::kNone_GradientType)
18 return false;
19
20 return shader->asABitmap(NULL, NULL, NULL) != SkShader::kNone_BitmapType;
21 }
22
23 } // namespace
24
25 PaintSimplifier::PaintSimplifier()
26 : INHERITED() {
27
28 }
29
30 PaintSimplifier::~PaintSimplifier() {
31
32 }
33
34 bool PaintSimplifier::filter(SkPaint* paint, Type type) {
35 // Bitmaps are expensive. Skip draw if type has a bitmap.
36 if (type == kBitmap_Type || PaintHasBitmap(*paint))
37 return false;
38
39 // Preserve a modicum of text quality; black & white text is
40 // just too blocky, even during a fling.
41 if (type != kText_Type) {
42 paint->setAntiAlias(false);
43 }
44 paint->setSubpixelText(false);
45 paint->setLCDRenderText(false);
46
47 paint->setMaskFilter(NULL);
48
49 // Uncomment this line to shade simplified tiles pink during debugging.
50 //paint->setColor(SkColorSetRGB(255, 127, 127));
51
52 return true;
53 }
54
55
56 } // namespace skia
57
58
OLDNEW
« no previous file with comments | « skia/ext/paint_simplifier.h ('k') | skia/skia_chrome.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698