OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void setLayerPosition(const IntPoint& position); | 68 void setLayerPosition(const IntPoint& position); |
69 // Change the tile size. This may invalidate all the existing tiles. | 69 // Change the tile size. This may invalidate all the existing tiles. |
70 void setTileSize(const IntSize& size); | 70 void setTileSize(const IntSize& size); |
71 | 71 |
72 bool skipsDraw() const { return m_skipsDraw; } | 72 bool skipsDraw() const { return m_skipsDraw; } |
73 | 73 |
74 // Reserves all existing and valid tile textures to protect them from being | 74 // Reserves all existing and valid tile textures to protect them from being |
75 // recycled by the texture manager. | 75 // recycled by the texture manager. |
76 void protectTileTextures(const IntRect& contentRect); | 76 void protectTileTextures(const IntRect& contentRect); |
77 | 77 |
78 typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexAlpha> Program
; | 78 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> Program
; |
79 // Shader program that swaps red and blue components of texture. | 79 // Shader program that swaps red and blue components of texture. |
80 // Used when texture format does not match native color format. | 80 // Used when texture format does not match native color format. |
81 typedef ProgramBinding<VertexShaderQuad, FragmentShaderRGBATexSwizzleAlpha>
ProgramSwizzle; | 81 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha>
ProgramSwizzle; |
| 82 |
| 83 // Shader program that produces anti-aliased layer edges. |
| 84 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlphaAA> Progr
amAA; |
| 85 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlphaAA
> ProgramSwizzleAA; |
82 | 86 |
83 // If this tiler has exactly one tile, return its texture. Otherwise, null. | 87 // If this tiler has exactly one tile, return its texture. Otherwise, null. |
84 LayerTexture* getSingleTexture(); | 88 LayerTexture* getSingleTexture(); |
85 | 89 |
86 private: | 90 private: |
87 LayerTilerChromium(LayerRendererChromium*, const IntSize& tileSize, BorderTe
xelOption); | 91 LayerTilerChromium(LayerRendererChromium*, const IntSize& tileSize, BorderTe
xelOption); |
88 | 92 |
89 class Tile : public RefCounted<Tile> { | 93 class Tile : public RefCounted<Tile> { |
90 WTF_MAKE_NONCOPYABLE(Tile); | 94 WTF_MAKE_NONCOPYABLE(Tile); |
91 public: | 95 public: |
(...skipping 11 matching lines...) Expand all Loading... |
103 // Layer-space dirty rectangle that needs to be repainted. | 107 // Layer-space dirty rectangle that needs to be repainted. |
104 IntRect m_dirtyLayerRect; | 108 IntRect m_dirtyLayerRect; |
105 private: | 109 private: |
106 OwnPtr<LayerTexture> m_tex; | 110 OwnPtr<LayerTexture> m_tex; |
107 int m_i; | 111 int m_i; |
108 int m_j; | 112 int m_j; |
109 }; | 113 }; |
110 | 114 |
111 // Draw all tiles that intersect with contentRect. | 115 // Draw all tiles that intersect with contentRect. |
112 template <class T> | 116 template <class T> |
113 void drawTiles(const IntRect& contentRect, const TransformationMatrix&, floa
t opacity, const T* program); | 117 void drawTiles(const IntRect& contentRect, const TransformationMatrix&, floa
t opacity, const T* program, int fragmentTexTransformLocation, int edgeLocation)
; |
114 | |
115 template <class T> | |
116 void drawTexturedQuad(GraphicsContext3D*, const FloatQuad&, const Transforma
tionMatrix& projectionMatrix, const TransformationMatrix& drawMatrix, | |
117 float width, float height, float opacity, | |
118 float texTranslateX, float texTranslateY, | |
119 float texScaleX, float texScaleY, | |
120 const T* program); | |
121 | 118 |
122 // Grow layer size to contain this rectangle. | 119 // Grow layer size to contain this rectangle. |
123 void growLayerToContain(const IntRect& contentRect); | 120 void growLayerToContain(const IntRect& contentRect); |
124 | 121 |
125 LayerRendererChromium* layerRenderer() const { return m_layerRenderer; } | 122 LayerRendererChromium* layerRenderer() const { return m_layerRenderer; } |
126 GraphicsContext3D* layerRendererContext() const; | 123 GraphicsContext3D* layerRendererContext() const; |
127 Tile* createTile(int i, int j); | 124 Tile* createTile(int i, int j); |
128 // Invalidate any tiles which do not intersect with the contentRect | 125 // Invalidate any tiles which do not intersect with the contentRect |
129 void invalidateTiles(const IntRect& contentRect); | 126 void invalidateTiles(const IntRect& contentRect); |
130 void reset(); | 127 void reset(); |
131 void contentRectToTileIndices(const IntRect& contentRect, int &left, int &to
p, int &right, int &bottom) const; | 128 void contentRectToTileIndices(const IntRect& contentRect, int &left, int &to
p, int &right, int &bottom) const; |
132 IntRect contentRectToLayerRect(const IntRect& contentRect) const; | 129 IntRect contentRectToLayerRect(const IntRect& contentRect) const; |
133 IntRect layerRectToContentRect(const IntRect& layerRect) const; | 130 IntRect layerRectToContentRect(const IntRect& layerRect) const; |
134 | 131 |
135 Tile* tileAt(int, int) const; | 132 Tile* tileAt(int, int) const; |
136 IntRect tileContentRect(const Tile*) const; | 133 IntRect tileContentRect(const Tile*) const; |
137 IntRect tileLayerRect(const Tile*) const; | 134 IntRect tileLayerRect(const Tile*) const; |
138 IntRect tileTexRect(const Tile*) const; | |
139 | 135 |
140 GC3Denum m_textureFormat; | 136 GC3Denum m_textureFormat; |
141 | 137 |
142 IntSize m_tileSize; | 138 IntSize m_tileSize; |
143 IntPoint m_layerPosition; | 139 IntPoint m_layerPosition; |
144 | 140 |
145 bool m_skipsDraw; | 141 bool m_skipsDraw; |
146 | 142 |
147 // Default hash key traits for integers disallow 0 and -1 as a key, so | 143 // Default hash key traits for integers disallow 0 and -1 as a key, so |
148 // use a custom hash trait which disallows -1 and -2 instead. | 144 // use a custom hash trait which disallows -1 and -2 instead. |
(...skipping 22 matching lines...) Expand all Loading... |
171 TilingData m_tilingData; | 167 TilingData m_tilingData; |
172 | 168 |
173 LayerRendererChromium* m_layerRenderer; | 169 LayerRendererChromium* m_layerRenderer; |
174 }; | 170 }; |
175 | 171 |
176 } | 172 } |
177 | 173 |
178 #endif // USE(ACCELERATED_COMPOSITING) | 174 #endif // USE(ACCELERATED_COMPOSITING) |
179 | 175 |
180 #endif | 176 #endif |
OLD | NEW |