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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.h

Issue 1949253004: Rounded background image fast path (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 26 matching lines...) Expand all
37 #include "wtf/Assertions.h" 37 #include "wtf/Assertions.h"
38 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefCounted.h" 40 #include "wtf/RefCounted.h"
41 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
42 #include "wtf/text/WTFString.h" 42 #include "wtf/text/WTFString.h"
43 43
44 class SkBitmap; 44 class SkBitmap;
45 class SkCanvas; 45 class SkCanvas;
46 class SkImage; 46 class SkImage;
47 class SkMatrix;
48 class SkPaint;
47 49
48 namespace blink { 50 namespace blink {
49 51
50 class FloatPoint; 52 class FloatPoint;
51 class FloatRect; 53 class FloatRect;
52 class FloatSize; 54 class FloatSize;
53 class GraphicsContext; 55 class GraphicsContext;
54 class Length; 56 class Length;
55 class SharedBuffer; 57 class SharedBuffer;
56 class Image; 58 class Image;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, 145 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode,
144 const FloatRect&, const FloatSize& repeatSpacing = FloatSize()); 146 const FloatRect&, const FloatSize& repeatSpacing = FloatSize());
145 147
146 enum ImageClampingMode { 148 enum ImageClampingMode {
147 ClampImageToSourceRect, 149 ClampImageToSourceRect,
148 DoNotClampImageToSourceRect 150 DoNotClampImageToSourceRect
149 }; 151 };
150 152
151 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; 153 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0;
152 154
155 virtual bool applyShader(SkPaint&, const SkMatrix* localMatrix);
156
157 // Compute the tile which contains a given point (assuming a repeating tile grid).
158 static FloatRect computeTileContaining(const FloatPoint&, const FloatSize& t ileSize,
chrishtr 2016/05/20 19:52:35 Also comment: input point and return value is in d
f(malita) 2016/05/22 14:04:07 Done.
159 const FloatPoint& tilePhase, const FloatSize& tileSpacing);
160
161 // Compute the image subset which gets mapped onto dest, when the whole imag e is drawn into
162 // tile. Assumes the tile contains dest.
163 static FloatRect computeSubsetForTile(const FloatRect& tile, const FloatRect & dest,
chrishtr 2016/05/20 19:52:35 Also comment: tile rect is in destination grid spa
f(malita) 2016/05/22 14:04:07 Done.
164 const FloatSize& imageSize);
165
153 protected: 166 protected:
154 Image(ImageObserver* = 0); 167 Image(ImageObserver* = 0);
155 168
156 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, 169 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
157 SkXfermode::Mode, const FloatSize& repeatSpacing); 170 SkXfermode::Mode, const FloatSize& repeatSpacing);
158 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe rmode::Mode); 171 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe rmode::Mode);
159 172
160 private: 173 private:
161 RefPtr<SharedBuffer> m_encodedImageData; 174 RefPtr<SharedBuffer> m_encodedImageData;
162 // TODO(Oilpan): consider having Image on the Oilpan heap and 175 // TODO(Oilpan): consider having Image on the Oilpan heap and
163 // turn this into a Member<>. 176 // turn this into a Member<>.
164 // 177 //
165 // The observer (an ImageResource) is an untraced member, with the ImageReso urce 178 // The observer (an ImageResource) is an untraced member, with the ImageReso urce
166 // being responsible of clearing itself out. 179 // being responsible of clearing itself out.
167 UntracedMember<ImageObserver> m_imageObserver; 180 UntracedMember<ImageObserver> m_imageObserver;
168 bool m_imageObserverDisabled; 181 bool m_imageObserverDisabled;
169 }; 182 };
170 183
171 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 184 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
172 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 185 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
173 186
174 } // namespace blink 187 } // namespace blink
175 188
176 #endif 189 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp ('k') | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698