| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
| 8 | 8 |
| 9 #include "CCRenderSurfaceFilters.h" | 9 #include "CCRenderSurfaceFilters.h" |
| 10 | 10 |
| 11 #include "base/logging.h" |
| 11 #include "FloatSize.h" | 12 #include "FloatSize.h" |
| 12 #include "SkBlurImageFilter.h" | 13 #include "SkBlurImageFilter.h" |
| 13 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 14 #include "SkColorMatrixFilter.h" | 15 #include "SkColorMatrixFilter.h" |
| 15 #include "SkGpuDevice.h" | 16 #include "SkGpuDevice.h" |
| 16 #include "SkGrPixelRef.h" | 17 #include "SkGrPixelRef.h" |
| 17 #include "SkMagnifierImageFilter.h" | 18 #include "SkMagnifierImageFilter.h" |
| 18 #include <public/WebFilterOperation.h> | 19 #include <public/WebFilterOperation.h> |
| 19 #include <public/WebFilterOperations.h> | 20 #include <public/WebFilterOperations.h> |
| 20 #include <public/WebGraphicsContext3D.h> | 21 #include <public/WebGraphicsContext3D.h> |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 m_canvas.reset(0); | 290 m_canvas.reset(0); |
| 290 m_device.reset(0); | 291 m_device.reset(0); |
| 291 | 292 |
| 292 m_source.setPixelRef(new SkGrPixelRef(m_scratchTextures[m_currentTexture
].get()))->unref(); | 293 m_source.setPixelRef(new SkGrPixelRef(m_scratchTextures[m_currentTexture
].get()))->unref(); |
| 293 m_currentTexture = 1 - m_currentTexture; | 294 m_currentTexture = 1 - m_currentTexture; |
| 294 } | 295 } |
| 295 | 296 |
| 296 private: | 297 private: |
| 297 void createCanvas() | 298 void createCanvas() |
| 298 { | 299 { |
| 299 ASSERT(m_scratchTextures[m_currentTexture].get()); | 300 DCHECK(m_scratchTextures[m_currentTexture].get()); |
| 300 m_device.reset(new SkGpuDevice(m_grContext, m_scratchTextures[m_currentT
exture].get())); | 301 m_device.reset(new SkGpuDevice(m_grContext, m_scratchTextures[m_currentT
exture].get())); |
| 301 m_canvas.reset(new SkCanvas(m_device.get())); | 302 m_canvas.reset(new SkCanvas(m_device.get())); |
| 302 m_canvas->clear(0x0); | 303 m_canvas->clear(0x0); |
| 303 } | 304 } |
| 304 | 305 |
| 305 GrContext* m_grContext; | 306 GrContext* m_grContext; |
| 306 SkBitmap m_source; | 307 SkBitmap m_source; |
| 307 SkAutoTUnref<GrTexture> m_scratchTextures[2]; | 308 SkAutoTUnref<GrTexture> m_scratchTextures[2]; |
| 308 int m_currentTexture; | 309 int m_currentTexture; |
| 309 SkAutoTUnref<SkGpuDevice> m_device; | 310 SkAutoTUnref<SkGpuDevice> m_device; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 break; | 427 break; |
| 427 } | 428 } |
| 428 case WebKit::WebFilterOperation::FilterTypeBrightness: | 429 case WebKit::WebFilterOperation::FilterTypeBrightness: |
| 429 case WebKit::WebFilterOperation::FilterTypeContrast: | 430 case WebKit::WebFilterOperation::FilterTypeContrast: |
| 430 case WebKit::WebFilterOperation::FilterTypeGrayscale: | 431 case WebKit::WebFilterOperation::FilterTypeGrayscale: |
| 431 case WebKit::WebFilterOperation::FilterTypeSepia: | 432 case WebKit::WebFilterOperation::FilterTypeSepia: |
| 432 case WebKit::WebFilterOperation::FilterTypeSaturate: | 433 case WebKit::WebFilterOperation::FilterTypeSaturate: |
| 433 case WebKit::WebFilterOperation::FilterTypeHueRotate: | 434 case WebKit::WebFilterOperation::FilterTypeHueRotate: |
| 434 case WebKit::WebFilterOperation::FilterTypeInvert: | 435 case WebKit::WebFilterOperation::FilterTypeInvert: |
| 435 case WebKit::WebFilterOperation::FilterTypeOpacity: | 436 case WebKit::WebFilterOperation::FilterTypeOpacity: |
| 436 ASSERT_NOT_REACHED(); | 437 NOTREACHED(); |
| 437 break; | 438 break; |
| 438 } | 439 } |
| 439 state.swap(); | 440 state.swap(); |
| 440 } | 441 } |
| 441 context3D->flush(); | 442 context3D->flush(); |
| 442 return state.source(); | 443 return state.source(); |
| 443 } | 444 } |
| 444 | 445 |
| 445 } | 446 } |
| 446 #endif // USE(ACCELERATED_COMPOSITING) | 447 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |