| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBlurImageFilter.h" | 8 #include "SkBlurImageFilter.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 // Now test out the SaveLayer extraction | 853 // Now test out the SaveLayer extraction |
| 854 { | 854 { |
| 855 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); | 855 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); |
| 856 | 856 |
| 857 SkAutoTUnref<SkSurface> surface(SkSurface::NewScratchRenderTarget(co
ntext, info)); | 857 SkAutoTUnref<SkSurface> surface(SkSurface::NewScratchRenderTarget(co
ntext, info)); |
| 858 | 858 |
| 859 SkCanvas* canvas = surface->getCanvas(); | 859 SkCanvas* canvas = surface->getCanvas(); |
| 860 | 860 |
| 861 canvas->EXPERIMENTAL_optimize(pict); | 861 canvas->EXPERIMENTAL_optimize(pict); |
| 862 | 862 |
| 863 SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); | 863 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); |
| 864 | 864 |
| 865 const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(k
ey); | 865 const SkPicture::AccelData* data = pict->EXPERIMENTAL_getAccelData(k
ey); |
| 866 REPORTER_ASSERT(reporter, NULL != data); | 866 REPORTER_ASSERT(reporter, NULL != data); |
| 867 | 867 |
| 868 const GPUAccelData *gpuData = static_cast<const GPUAccelData*>(data)
; | 868 const GrAccelData *gpuData = static_cast<const GrAccelData*>(data); |
| 869 REPORTER_ASSERT(reporter, 5 == gpuData->numSaveLayers()); | 869 REPORTER_ASSERT(reporter, 5 == gpuData->numSaveLayers()); |
| 870 | 870 |
| 871 const GPUAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0)
; | 871 const GrAccelData::SaveLayerInfo& info0 = gpuData->saveLayerInfo(0); |
| 872 // The parent/child layer appear in reverse order | 872 // The parent/child layer appear in reverse order |
| 873 const GPUAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2)
; | 873 const GrAccelData::SaveLayerInfo& info1 = gpuData->saveLayerInfo(2); |
| 874 const GPUAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1)
; | 874 const GrAccelData::SaveLayerInfo& info2 = gpuData->saveLayerInfo(1); |
| 875 const GPUAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3)
; | 875 const GrAccelData::SaveLayerInfo& info3 = gpuData->saveLayerInfo(3); |
| 876 // const GPUAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(4); | 876 // const GrAccelData::SaveLayerInfo& info4 = gpuData->saveLayerInfo(4); |
| 877 | 877 |
| 878 REPORTER_ASSERT(reporter, info0.fValid); | 878 REPORTER_ASSERT(reporter, info0.fValid); |
| 879 REPORTER_ASSERT(reporter, kWidth == info0.fSize.fWidth && kHeight ==
info0.fSize.fHeight); | 879 REPORTER_ASSERT(reporter, kWidth == info0.fSize.fWidth && kHeight ==
info0.fSize.fHeight); |
| 880 REPORTER_ASSERT(reporter, info0.fCTM.isIdentity()); | 880 REPORTER_ASSERT(reporter, info0.fCTM.isIdentity()); |
| 881 REPORTER_ASSERT(reporter, 0 == info0.fOffset.fX && 0 == info0.fOffse
t.fY); | 881 REPORTER_ASSERT(reporter, 0 == info0.fOffset.fX && 0 == info0.fOffse
t.fY); |
| 882 REPORTER_ASSERT(reporter, NULL != info0.fPaint); | 882 REPORTER_ASSERT(reporter, NULL != info0.fPaint); |
| 883 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayer
s); | 883 REPORTER_ASSERT(reporter, !info0.fIsNested && !info0.fHasNestedLayer
s); |
| 884 | 884 |
| 885 REPORTER_ASSERT(reporter, info1.fValid); | 885 REPORTER_ASSERT(reporter, info1.fValid); |
| 886 REPORTER_ASSERT(reporter, kWidth == info1.fSize.fWidth && kHeight ==
info1.fSize.fHeight); | 886 REPORTER_ASSERT(reporter, kWidth == info1.fSize.fWidth && kHeight ==
info1.fSize.fHeight); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 make_bm(&replayBM, 100, 100, SK_ColorBLACK, false); | 1651 make_bm(&replayBM, 100, 100, SK_ColorBLACK, false); |
| 1652 SkCanvas replayCanvas(replayBM); | 1652 SkCanvas replayCanvas(replayBM); |
| 1653 picture->draw(&replayCanvas); | 1653 picture->draw(&replayCanvas); |
| 1654 replayCanvas.flush(); | 1654 replayCanvas.flush(); |
| 1655 | 1655 |
| 1656 // With the bug present, at (55, 55) we would get a fully opaque red | 1656 // With the bug present, at (55, 55) we would get a fully opaque red |
| 1657 // intead of a dark red. | 1657 // intead of a dark red. |
| 1658 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); | 1658 REPORTER_ASSERT(reporter, replayBM.getColor(30, 30) == 0xff000080); |
| 1659 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); | 1659 REPORTER_ASSERT(reporter, replayBM.getColor(55, 55) == 0xff800000); |
| 1660 } | 1660 } |
| OLD | NEW |