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

Unified Diff: ui/gfx/skia_util.cc

Issue 854713003: More old files deletion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix tryjobs? Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/skia_util.h ('k') | ui/gfx/sys_color_change_listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skia_util.cc
diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc
index 0a991df20aa56630b5d969badd717e2bed7a445b..ac98f4920e08a181bf2004601b55b85b6d0e0062 100644
--- a/ui/gfx/skia_util.cc
+++ b/ui/gfx/skia_util.cc
@@ -11,10 +11,8 @@
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "third_party/skia/include/effects/SkLayerDrawLooper.h"
-#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_f.h"
-#include "ui/gfx/shadow_value.h"
#include "ui/gfx/transform.h"
namespace gfx {
@@ -61,35 +59,6 @@ void TransformToFlattenedSkMatrix(const gfx::Transform& transform,
flattened->set(8, SkMScalarToScalar(transform.matrix().get(3, 3)));
}
-skia::RefPtr<SkShader> CreateImageRepShader(const gfx::ImageSkiaRep& image_rep,
- SkShader::TileMode tile_mode,
- const SkMatrix& local_matrix) {
- return CreateImageRepShaderForScale(image_rep, tile_mode, local_matrix,
- image_rep.scale());
-}
-
-skia::RefPtr<SkShader> CreateImageRepShaderForScale(
- const gfx::ImageSkiaRep& image_rep,
- SkShader::TileMode tile_mode,
- const SkMatrix& local_matrix,
- SkScalar scale) {
- // Unscale matrix by |scale| such that the bitmap is drawn at the
- // correct density.
- // Convert skew and translation to pixel coordinates.
- // Thus, for |bitmap_scale| = 2:
- // x scale = 2, x translation = 1 DIP,
- // should be converted to
- // x scale = 1, x translation = 2 pixels.
- SkMatrix shader_scale = local_matrix;
- shader_scale.preScale(scale, scale);
- shader_scale.setScaleX(local_matrix.getScaleX() / scale);
- shader_scale.setScaleY(local_matrix.getScaleY() / scale);
-
- skia::RefPtr<SkShader> shader = skia::AdoptRef(SkShader::CreateBitmapShader(
- image_rep.sk_bitmap(), tile_mode, tile_mode, &shader_scale));
- return shader;
-}
-
skia::RefPtr<SkShader> CreateGradientShader(int start_point,
int end_point,
SkColor start_color,
@@ -103,50 +72,6 @@ skia::RefPtr<SkShader> CreateGradientShader(int start_point,
grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode));
}
-static SkScalar RadiusToSigma(double radius) {
- // This captures historically what skia did under the hood. Now skia accepts
- // sigma, not radius, so we perform the conversion.
- return radius > 0 ? SkDoubleToScalar(0.57735f * radius + 0.5) : 0;
-}
-
-skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper(
- const std::vector<ShadowValue>& shadows) {
- if (shadows.empty())
- return skia::RefPtr<SkDrawLooper>();
-
- SkLayerDrawLooper::Builder looper_builder;
-
- looper_builder.addLayer(); // top layer of the original.
-
- SkLayerDrawLooper::LayerInfo layer_info;
- layer_info.fPaintBits |= SkLayerDrawLooper::kMaskFilter_Bit;
- layer_info.fPaintBits |= SkLayerDrawLooper::kColorFilter_Bit;
- layer_info.fColorMode = SkXfermode::kSrc_Mode;
-
- for (size_t i = 0; i < shadows.size(); ++i) {
- const ShadowValue& shadow = shadows[i];
-
- layer_info.fOffset.set(SkIntToScalar(shadow.x()),
- SkIntToScalar(shadow.y()));
-
- // SkBlurMaskFilter's blur radius defines the range to extend the blur from
- // original mask, which is half of blur amount as defined in ShadowValue.
- skia::RefPtr<SkMaskFilter> blur_mask = skia::AdoptRef(
- SkBlurMaskFilter::Create(kNormal_SkBlurStyle,
- RadiusToSigma(shadow.blur() / 2),
- SkBlurMaskFilter::kHighQuality_BlurFlag));
- skia::RefPtr<SkColorFilter> color_filter = skia::AdoptRef(
- SkColorFilter::CreateModeFilter(shadow.color(),
- SkXfermode::kSrcIn_Mode));
-
- SkPaint* paint = looper_builder.addLayer(layer_info);
- paint->setMaskFilter(blur_mask.get());
- paint->setColorFilter(color_filter.get());
- }
-
- return skia::AdoptRef<SkDrawLooper>(looper_builder.detachLooper());
-}
-
bool BitmapsAreEqual(const SkBitmap& bitmap1, const SkBitmap& bitmap2) {
void* addr1 = NULL;
void* addr2 = NULL;
« no previous file with comments | « ui/gfx/skia_util.h ('k') | ui/gfx/sys_color_change_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698