| 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 #include "CCRenderSurfaceFilters.h" | 7 #include "CCRenderSurfaceFilters.h" |
| 8 | 8 |
| 9 #include "base/logging.h" |
| 9 #include "FloatSize.h" | 10 #include "FloatSize.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 12 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 12 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 13 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
| 13 #include "third_party/skia/include/effects/SkMagnifierImageFilter.h" | 14 #include "third_party/skia/include/effects/SkMagnifierImageFilter.h" |
| 14 #include "third_party/skia/include/gpu/SkGpuDevice.h" | 15 #include "third_party/skia/include/gpu/SkGpuDevice.h" |
| 15 #include "third_party/skia/include/gpu/SkGrPixelRef.h" | 16 #include "third_party/skia/include/gpu/SkGrPixelRef.h" |
| 16 #include <public/WebFilterOperation.h> | 17 #include <public/WebFilterOperation.h> |
| 17 #include <public/WebFilterOperations.h> | 18 #include <public/WebFilterOperations.h> |
| 18 #include <public/WebGraphicsContext3D.h> | 19 #include <public/WebGraphicsContext3D.h> |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 m_canvas.reset(0); | 288 m_canvas.reset(0); |
| 288 m_device.reset(0); | 289 m_device.reset(0); |
| 289 | 290 |
| 290 m_source.setPixelRef(new SkGrPixelRef(m_scratchTextures[m_currentTexture
].get()))->unref(); | 291 m_source.setPixelRef(new SkGrPixelRef(m_scratchTextures[m_currentTexture
].get()))->unref(); |
| 291 m_currentTexture = 1 - m_currentTexture; | 292 m_currentTexture = 1 - m_currentTexture; |
| 292 } | 293 } |
| 293 | 294 |
| 294 private: | 295 private: |
| 295 void createCanvas() | 296 void createCanvas() |
| 296 { | 297 { |
| 297 ASSERT(m_scratchTextures[m_currentTexture].get()); | 298 DCHECK(m_scratchTextures[m_currentTexture].get()); |
| 298 m_device.reset(new SkGpuDevice(m_grContext, m_scratchTextures[m_currentT
exture].get())); | 299 m_device.reset(new SkGpuDevice(m_grContext, m_scratchTextures[m_currentT
exture].get())); |
| 299 m_canvas.reset(new SkCanvas(m_device.get())); | 300 m_canvas.reset(new SkCanvas(m_device.get())); |
| 300 m_canvas->clear(0x0); | 301 m_canvas->clear(0x0); |
| 301 } | 302 } |
| 302 | 303 |
| 303 GrContext* m_grContext; | 304 GrContext* m_grContext; |
| 304 SkBitmap m_source; | 305 SkBitmap m_source; |
| 305 SkAutoTUnref<GrTexture> m_scratchTextures[2]; | 306 SkAutoTUnref<GrTexture> m_scratchTextures[2]; |
| 306 int m_currentTexture; | 307 int m_currentTexture; |
| 307 SkAutoTUnref<SkGpuDevice> m_device; | 308 SkAutoTUnref<SkGpuDevice> m_device; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 break; | 425 break; |
| 425 } | 426 } |
| 426 case WebKit::WebFilterOperation::FilterTypeBrightness: | 427 case WebKit::WebFilterOperation::FilterTypeBrightness: |
| 427 case WebKit::WebFilterOperation::FilterTypeContrast: | 428 case WebKit::WebFilterOperation::FilterTypeContrast: |
| 428 case WebKit::WebFilterOperation::FilterTypeGrayscale: | 429 case WebKit::WebFilterOperation::FilterTypeGrayscale: |
| 429 case WebKit::WebFilterOperation::FilterTypeSepia: | 430 case WebKit::WebFilterOperation::FilterTypeSepia: |
| 430 case WebKit::WebFilterOperation::FilterTypeSaturate: | 431 case WebKit::WebFilterOperation::FilterTypeSaturate: |
| 431 case WebKit::WebFilterOperation::FilterTypeHueRotate: | 432 case WebKit::WebFilterOperation::FilterTypeHueRotate: |
| 432 case WebKit::WebFilterOperation::FilterTypeInvert: | 433 case WebKit::WebFilterOperation::FilterTypeInvert: |
| 433 case WebKit::WebFilterOperation::FilterTypeOpacity: | 434 case WebKit::WebFilterOperation::FilterTypeOpacity: |
| 434 ASSERT_NOT_REACHED(); | 435 NOTREACHED(); |
| 435 break; | 436 break; |
| 436 } | 437 } |
| 437 state.swap(); | 438 state.swap(); |
| 438 } | 439 } |
| 439 context3D->flush(); | 440 context3D->flush(); |
| 440 return state.source(); | 441 return state.source(); |
| 441 } | 442 } |
| 442 | 443 |
| 443 } | 444 } |
| OLD | NEW |