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

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

Issue 2582383002: Clamp background tiles when possible (Closed)
Patch Set: rebaseline Created 3 years, 12 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // setImageObserverDisabled() other than from ImageObserverDisabler. 149 // setImageObserverDisabled() other than from ImageObserverDisabler.
150 void setImageObserverDisabled(bool disabled) { 150 void setImageObserverDisabled(bool disabled) {
151 m_imageObserverDisabled = disabled; 151 m_imageObserverDisabled = disabled;
152 } 152 }
153 153
154 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; 154 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile };
155 155
156 virtual sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; 156 virtual sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0;
157 virtual PassRefPtr<Image> imageForDefaultFrame(); 157 virtual PassRefPtr<Image> imageForDefaultFrame();
158 158
159 virtual void drawPattern(GraphicsContext&,
160 const FloatRect&,
161 const FloatSize&,
162 const FloatPoint& phase,
163 SkBlendMode,
164 const FloatRect&,
165 const FloatSize& repeatSpacing = FloatSize());
166
167 enum ImageClampingMode { 159 enum ImageClampingMode {
168 ClampImageToSourceRect, 160 ClampImageToSourceRect,
169 DoNotClampImageToSourceRect 161 DoNotClampImageToSourceRect
170 }; 162 };
171 163
172 virtual void draw(SkCanvas*, 164 virtual void draw(SkCanvas*,
173 const SkPaint&, 165 const SkPaint&,
174 const FloatRect& dstRect, 166 const FloatRect& dstRect,
175 const FloatRect& srcRect, 167 const FloatRect& srcRect,
176 RespectImageOrientationEnum, 168 RespectImageOrientationEnum,
(...skipping 29 matching lines...) Expand all
206 SkBlendMode, 198 SkBlendMode,
207 const FloatSize& repeatSpacing); 199 const FloatSize& repeatSpacing);
208 void drawTiledBorder(GraphicsContext&, 200 void drawTiledBorder(GraphicsContext&,
209 const FloatRect& dstRect, 201 const FloatRect& dstRect,
210 const FloatRect& srcRect, 202 const FloatRect& srcRect,
211 const FloatSize& tileScaleFactor, 203 const FloatSize& tileScaleFactor,
212 TileRule hRule, 204 TileRule hRule,
213 TileRule vRule, 205 TileRule vRule,
214 SkBlendMode); 206 SkBlendMode);
215 207
208 virtual void drawPattern(GraphicsContext&,
209 const FloatRect&,
210 const FloatSize&,
211 const FloatPoint& phase,
212 SkBlendMode,
213 const FloatRect&,
214 const FloatSize& repeatSpacing = FloatSize());
215
216 private: 216 private:
217 RefPtr<SharedBuffer> m_encodedImageData; 217 RefPtr<SharedBuffer> m_encodedImageData;
218 // TODO(Oilpan): consider having Image on the Oilpan heap and 218 // TODO(Oilpan): consider having Image on the Oilpan heap and
219 // turn this into a Member<>. 219 // turn this into a Member<>.
220 // 220 //
221 // The observer (an ImageResourceContent) is an untraced member, with the 221 // The observer (an ImageResourceContent) is an untraced member, with the
222 // ImageResourceContent being responsible for clearing itself out. 222 // ImageResourceContent being responsible for clearing itself out.
223 UntracedMember<ImageObserver> m_imageObserver; 223 UntracedMember<ImageObserver> m_imageObserver;
224 bool m_imageObserverDisabled; 224 bool m_imageObserverDisabled;
225 }; 225 };
226 226
227 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 227 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
228 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), \ 228 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), \
229 image.is##typeName()) 229 image.is##typeName())
230 230
231 } // namespace blink 231 } // namespace blink
232 232
233 #endif 233 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698