| 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 "cc/render_surface_filters.h" | 5 #include "cc/render_surface_filters.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "skia/ext/refptr.h" | 8 #include "skia/ext/refptr.h" |
| 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.
h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 417 paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
| 418 canvas->saveLayer(NULL, &paint); | 418 canvas->saveLayer(NULL, &paint); |
| 419 canvas->drawBitmap(state.Source(), | 419 canvas->drawBitmap(state.Source(), |
| 420 op.dropShadowOffset().x, | 420 op.dropShadowOffset().x, |
| 421 -op.dropShadowOffset().y); | 421 -op.dropShadowOffset().y); |
| 422 canvas->restore(); | 422 canvas->restore(); |
| 423 canvas->drawBitmap(state.Source(), 0, 0); | 423 canvas->drawBitmap(state.Source(), 0, 0); |
| 424 break; | 424 break; |
| 425 } | 425 } |
| 426 case WebKit::WebFilterOperation::FilterTypeZoom: { | 426 case WebKit::WebFilterOperation::FilterTypeZoom: { |
| 427 #ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls. | |
| 428 SkPaint paint; | 427 SkPaint paint; |
| 429 int width = state.Source().width(); | 428 int width = state.Source().width(); |
| 430 int height = state.Source().height(); | 429 int height = state.Source().height(); |
| 431 skia::RefPtr<SkImageFilter> zoom_filter = skia::AdoptRef( | 430 skia::RefPtr<SkImageFilter> zoom_filter = skia::AdoptRef( |
| 432 new SkMagnifierImageFilter( | 431 new SkMagnifierImageFilter( |
| 433 SkRect::MakeXYWH( | 432 SkRect::MakeXYWH( |
| 434 (width - (width / op.amount())) / 2.f, | 433 (width - (width / op.amount())) / 2.f, |
| 435 (height - (height / op.amount())) / 2.f, | 434 (height - (height / op.amount())) / 2.f, |
| 436 width / op.amount(), | 435 width / op.amount(), |
| 437 height / op.amount()), | 436 height / op.amount()), |
| 438 op.zoomInset())); | 437 op.zoomInset())); |
| 439 paint.setImageFilter(zoom_filter.get()); | 438 paint.setImageFilter(zoom_filter.get()); |
| 440 canvas->saveLayer(NULL, &paint); | 439 canvas->saveLayer(NULL, &paint); |
| 441 canvas->drawBitmap(state.Source(), 0, 0); | 440 canvas->drawBitmap(state.Source(), 0, 0); |
| 442 canvas->restore(); | 441 canvas->restore(); |
| 443 #endif | |
| 444 break; | 442 break; |
| 445 } | 443 } |
| 446 case WebKit::WebFilterOperation::FilterTypeBrightness: | 444 case WebKit::WebFilterOperation::FilterTypeBrightness: |
| 447 case WebKit::WebFilterOperation::FilterTypeSaturatingBrightness: | 445 case WebKit::WebFilterOperation::FilterTypeSaturatingBrightness: |
| 448 case WebKit::WebFilterOperation::FilterTypeContrast: | 446 case WebKit::WebFilterOperation::FilterTypeContrast: |
| 449 case WebKit::WebFilterOperation::FilterTypeGrayscale: | 447 case WebKit::WebFilterOperation::FilterTypeGrayscale: |
| 450 case WebKit::WebFilterOperation::FilterTypeSepia: | 448 case WebKit::WebFilterOperation::FilterTypeSepia: |
| 451 case WebKit::WebFilterOperation::FilterTypeSaturate: | 449 case WebKit::WebFilterOperation::FilterTypeSaturate: |
| 452 case WebKit::WebFilterOperation::FilterTypeHueRotate: | 450 case WebKit::WebFilterOperation::FilterTypeHueRotate: |
| 453 case WebKit::WebFilterOperation::FilterTypeInvert: | 451 case WebKit::WebFilterOperation::FilterTypeInvert: |
| 454 case WebKit::WebFilterOperation::FilterTypeOpacity: | 452 case WebKit::WebFilterOperation::FilterTypeOpacity: |
| 455 NOTREACHED(); | 453 NOTREACHED(); |
| 456 break; | 454 break; |
| 457 } | 455 } |
| 458 state.Swap(); | 456 state.Swap(); |
| 459 } | 457 } |
| 460 return state.Source(); | 458 return state.Source(); |
| 461 } | 459 } |
| 462 | 460 |
| 463 } // namespace cc | 461 } // namespace cc |
| OLD | NEW |