Commit 2c9345eb authored by vmpstr's avatar vmpstr Committed by Commit bot

skia/ext: Removed paint simplifier.

We no longer use this class, so we should remove it.

Note: this depends on https://codereview.chromium.org/603683006

R=danakj, junov

Review URL: https://codereview.chromium.org/610743002

Cr-Commit-Position: refs/heads/master@{#297448}
parent 51d5f291
......@@ -274,8 +274,6 @@ component("skia") {
"ext/SkThread_chrome.cc",
"ext/opacity_draw_filter.cc",
"ext/opacity_draw_filter.h",
"ext/paint_simplifier.cc",
"ext/paint_simplifier.h",
"ext/pixel_ref_utils.cc",
"ext/pixel_ref_utils.h",
"ext/platform_canvas.cc",
......
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "skia/ext/paint_simplifier.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkShader.h"
namespace skia {
namespace {
bool PaintHasBitmap(const SkPaint &paint) {
SkShader* shader = paint.getShader();
if (!shader)
return false;
if (shader->asAGradient(NULL) == SkShader::kNone_GradientType)
return false;
return shader->asABitmap(NULL, NULL, NULL) != SkShader::kNone_BitmapType;
}
} // namespace
PaintSimplifier::PaintSimplifier()
: INHERITED() {
}
PaintSimplifier::~PaintSimplifier() {
}
bool PaintSimplifier::filter(SkPaint* paint, Type type) {
// Bitmaps are expensive. Skip draw if type has a bitmap.
if (type == kBitmap_Type || PaintHasBitmap(*paint))
return false;
// Preserve a modicum of text quality; black & white text is
// just too blocky, even during a fling.
if (type != kText_Type) {
paint->setAntiAlias(false);
}
paint->setSubpixelText(false);
paint->setLCDRenderText(false);
paint->setMaskFilter(NULL);
// Uncomment this line to shade simplified tiles pink during debugging.
//paint->setColor(SkColorSetRGB(255, 127, 127));
return true;
}
} // namespace skia
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKIA_EXT_PAINT_SIMPLIFIER_H
#define SKIA_EXT_PAINT_SIMPLIFIER_H
#include "base/values.h"
#include "third_party/skia/include/core/SkDrawFilter.h"
class SkPaint;
namespace skia {
/*
When installed on a SkCanvas, reduces the quality of all draws
to that canvas. This improves rasterization speed during flings.
We turn off blurs, filters, and antialiasing *except for* text.
*/
class SK_API PaintSimplifier : public SkDrawFilter {
public:
PaintSimplifier();
virtual ~PaintSimplifier();
virtual bool filter(SkPaint*, Type) OVERRIDE;
private:
typedef SkDrawFilter INHERITED;
};
} // namespace skia
#endif // SKIA_EXT_PAINT_SIMPLIFIER_H
......@@ -56,8 +56,6 @@
'ext/lazy_pixel_ref.h',
'ext/opacity_draw_filter.cc',
'ext/opacity_draw_filter.h',
'ext/paint_simplifier.cc',
'ext/paint_simplifier.h',
'ext/pixel_ref_utils.cc',
'ext/pixel_ref_utils.h',
'ext/platform_canvas.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment