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

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

Issue 1456813002: Calculate Background Image Geometries using sub-pixel values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to applySubPixelHeuristicToImageSize Created 5 years 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ImageObserver* imageObserver() const { return m_imageObserver; } 131 ImageObserver* imageObserver() const { return m_imageObserver; }
132 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer; } 132 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer; }
133 133
134 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; 134 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile };
135 135
136 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0; 136 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0;
137 virtual PassRefPtr<Image> imageForDefaultFrame(); 137 virtual PassRefPtr<Image> imageForDefaultFrame();
138 138
139 virtual void drawPattern(GraphicsContext*, const FloatRect&, 139 virtual void drawPattern(GraphicsContext*, const FloatRect&,
140 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, 140 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode,
141 const FloatRect&, const IntSize& repeatSpacing = IntSize()); 141 const FloatRect&, const FloatSize& repeatSpacing = FloatSize());
142 142
143 enum ImageClampingMode { 143 enum ImageClampingMode {
144 ClampImageToSourceRect, 144 ClampImageToSourceRect,
145 DoNotClampImageToSourceRect 145 DoNotClampImageToSourceRect
146 }; 146 };
147 147
148 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; 148 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0;
149 149
150 protected: 150 protected:
151 Image(ImageObserver* = 0); 151 Image(ImageObserver* = 0);
152 152
153 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, 153 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize,
154 SkXfermode::Mode, const IntSize& repeatSpacing); 154 SkXfermode::Mode, const FloatSize& repeatSpacing);
155 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe rmode::Mode); 155 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe rmode::Mode);
156 156
157 private: 157 private:
158 RefPtr<SharedBuffer> m_encodedImageData; 158 RefPtr<SharedBuffer> m_encodedImageData;
159 ImageObserver* m_imageObserver; 159 ImageObserver* m_imageObserver;
160 }; 160 };
161 161
162 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 162 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
163 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 163 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
164 164
165 } // namespace blink 165 } // namespace blink
166 166
167 #endif 167 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698