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

Unified Diff: Source/platform/graphics/BitmapPattern.cpp

Issue 1290983003: SkImage-only bitmap patterns (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: drop non-repeat optimization Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/graphics/BitmapPattern.cpp
diff --git a/Source/platform/graphics/BitmapPattern.cpp b/Source/platform/graphics/BitmapPattern.cpp
deleted file mode 100644
index 2657d439da5d1763e159379374226b7b2c68a1a3..0000000000000000000000000000000000000000
--- a/Source/platform/graphics/BitmapPattern.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2014 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 "config.h"
-#include "platform/graphics/BitmapPattern.h"
-
-#include "platform/graphics/skia/SkiaUtils.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkShader.h"
-
-namespace blink {
-
-BitmapPattern::BitmapPattern(PassRefPtr<Image> image, RepeatMode repeatMode)
-: BitmapPatternBase(repeatMode, 0 )
-{
- if (image) {
- // If image is animated, what about the pattern?
- if (image->deprecatedBitmapForCurrentFrame(&m_tileImage))
- adjustExternalMemoryAllocated(m_tileImage.getSafeSize());
- }
-}
-
-PassRefPtr<SkShader> BitmapPattern::createShader()
-{
- if (m_tileImage.isNull()) {
- return adoptRef(SkShader::CreateColorShader(SK_ColorTRANSPARENT));
- }
-
- SkMatrix localMatrix = affineTransformToSkMatrix(m_patternSpaceTransformation);
-
- if (isRepeatXY()) {
- return adoptRef(SkShader::CreateBitmapShader(m_tileImage, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &localMatrix));
- }
-
- return BitmapPatternBase::createShader();
-}
-
-SkImageInfo BitmapPattern::getBitmapInfo()
-{
- return m_tileImage.info();
-}
-
-void BitmapPattern::drawBitmapToCanvas(SkCanvas& canvas, SkPaint& paint)
-{
- canvas.drawBitmap(m_tileImage, SkIntToScalar(0), SkIntToScalar(0), &paint);
-}
-
-} // namespace

Powered by Google App Engine
This is Rietveld 408576698