diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-12 21:01:41 +0000 |
commit | 52e935d04c59135739c3a68fb6e19d313dc6d5ad (patch) | |
tree | 95f7ab178b045bef4456cbf92c6aa7e476becd99 /skia/include | |
parent | 30fab79877b4bb067944b74d98346ac9bb6bfc7e (diff) | |
download | chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.zip chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.gz chromium_src-52e935d04c59135739c3a68fb6e19d313dc6d5ad.tar.bz2 |
New drop of Skia. This is up to CL 121320.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/include')
147 files changed, 2726 insertions, 1749 deletions
diff --git a/skia/include/Sk1DPathEffect.h b/skia/include/Sk1DPathEffect.h index 6679a26..db01055 100644 --- a/skia/include/Sk1DPathEffect.h +++ b/skia/include/Sk1DPathEffect.h @@ -1,17 +1,18 @@ -/* Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef Sk1DPathEffect_DEFINED #define Sk1DPathEffect_DEFINED diff --git a/skia/include/Sk2DPathEffect.h b/skia/include/Sk2DPathEffect.h index 832dbcc..6e54d0a 100644 --- a/skia/include/Sk2DPathEffect.h +++ b/skia/include/Sk2DPathEffect.h @@ -1,19 +1,18 @@ -/* include/graphics/Sk2DPathEffect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef Sk2DPathEffect_DEFINED #define Sk2DPathEffect_DEFINED diff --git a/skia/include/SkAnimator.h b/skia/include/SkAnimator.h index 5bed8c7..04d342c 100644 --- a/skia/include/SkAnimator.h +++ b/skia/include/SkAnimator.h @@ -1,19 +1,18 @@ -/* include/graphics/SkAnimator.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkAnimator_DEFINED #define SkAnimator_DEFINED diff --git a/skia/include/SkAnimatorView.h b/skia/include/SkAnimatorView.h index 44e951c..3c6c8a1 100644 --- a/skia/include/SkAnimatorView.h +++ b/skia/include/SkAnimatorView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkAnimatorView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkAnimatorView_DEFINED #define SkAnimatorView_DEFINED diff --git a/skia/include/SkApplication.h b/skia/include/SkApplication.h index 91be3cf..4c4a4fb0 100644 --- a/skia/include/SkApplication.h +++ b/skia/include/SkApplication.h @@ -1,19 +1,18 @@ -/* include/graphics/SkApplication.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkApplication_DEFINED #define SkApplication_DEFINED diff --git a/skia/include/SkAvoidXfermode.h b/skia/include/SkAvoidXfermode.h index 0696b92..32bc049 100644 --- a/skia/include/SkAvoidXfermode.h +++ b/skia/include/SkAvoidXfermode.h @@ -1,19 +1,18 @@ -/* include/graphics/SkAvoidXfermode.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkAvoidXfermode_DEFINED #define SkAvoidXfermode_DEFINED diff --git a/skia/include/SkBGViewArtist.h b/skia/include/SkBGViewArtist.h index 3ea264d..1bca42f 100644 --- a/skia/include/SkBGViewArtist.h +++ b/skia/include/SkBGViewArtist.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBGViewArtist.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBGViewArtist_DEFINED #define SkBGViewArtist_DEFINED diff --git a/skia/include/SkBML_WXMLParser.h b/skia/include/SkBML_WXMLParser.h index b1da4ba..faa127d 100644 --- a/skia/include/SkBML_WXMLParser.h +++ b/skia/include/SkBML_WXMLParser.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBML_WXMLParser.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBML_WXMLParser_DEFINED #define SkBML_WXMLParser_DEFINED diff --git a/skia/include/SkBML_XMLParser.h b/skia/include/SkBML_XMLParser.h index e2c3e29..f056bca 100644 --- a/skia/include/SkBML_XMLParser.h +++ b/skia/include/SkBML_XMLParser.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBML_XMLParser.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBML_XMLParser_DEFINED #define SkBML_XMLParser_DEFINED diff --git a/skia/include/SkBitmap.h b/skia/include/SkBitmap.h index 18db5a9..02c8cd9 100644 --- a/skia/include/SkBitmap.h +++ b/skia/include/SkBitmap.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ #include "SkRefCnt.h" #if defined(SK_BUILD_FOR_MAC) -#include <Carbon/Carbon.h> +#include <carbon/carbon.h> #endif struct SkIRect; @@ -172,6 +172,9 @@ public: static int ComputeShiftPerPixel(Config c) { return ComputeBytesPerPixel(c) >> 1; } + + static Sk64 ComputeSize64(Config, int width, int height); + static size_t ComputeSize(Config, int width, int height); /** Set the bitmap's config and dimensions. If rowBytes is 0, then ComputeRowBytes() is called to compute the optimal value. This resets @@ -181,6 +184,10 @@ public: /** Use this to assign a new pixel address for an existing bitmap. This will automatically release any pixelref previously installed. Only call this if you are handling ownership/lifetime of the pixel memory. + + If the bitmap retains a reference to the colortable (assuming it is + not null) it will take care of incrementing the reference count. + @param pixels Address for the pixels, managed by the caller. @param ctable ColorTable (or null) that matches the specified pixels */ @@ -191,6 +198,9 @@ public: If this is called multiple times, a new pixelref object will be created each time. + If the bitmap retains a reference to the colortable (assuming it is + not null) it will take care of incrementing the reference count. + @param ctable ColorTable (or null) to use with the pixels that will be allocated. Only used if config == Index8_Config @return true if the allocation succeeds. If not the pixelref field of @@ -205,6 +215,9 @@ public: If this is called multiple times, a new pixelref object will be created each time. + If the bitmap retains a reference to the colortable (assuming it is + not null) it will take care of incrementing the reference count. + @param allocator The Allocator to use to create a pixelref that can manage the pixel memory for the current width/height/config. If allocator is NULL, the standard @@ -243,6 +256,16 @@ public: */ void unlockPixels() const; + /** Call this to be sure that the bitmap is valid enough to be drawn (i.e. + it has non-null pixels, and if required by its config, it has a + non-null colortable. Returns true if all of the above are met. + */ + bool readyToDraw() const { + return this->getPixels() != NULL && + ((this->config() != kIndex8_Config && this->config() != kRLE_Index8_Config) || + fColorTable != NULL); + } + /** Return the bitmap's colortable (if any). Does not affect the colortable's reference count. */ @@ -568,6 +591,56 @@ private: const SkBitmap& fBitmap; }; +/** Helper class that performs the lock/unlockColors calls on a colortable. + The destructor will call unlockColors(false) if it has a bitmap's colortable +*/ +class SkAutoLockColors : public SkNoncopyable { +public: + /** Initialize with no bitmap. Call lockColors(bitmap) to lock bitmap's + colortable + */ + SkAutoLockColors() : fCTable(NULL), fColors(NULL) {} + /** Initialize with bitmap, locking its colortable if present + */ + explicit SkAutoLockColors(const SkBitmap& bm) { + fCTable = bm.getColorTable(); + fColors = fCTable ? fCTable->lockColors() : NULL; + } + /** Initialize with a colortable (may be null) + */ + explicit SkAutoLockColors(SkColorTable* ctable) { + fCTable = ctable; + fColors = ctable ? ctable->lockColors() : NULL; + } + ~SkAutoLockColors() { + if (fCTable) { + fCTable->unlockColors(false); + } + } + + /** Return the currently locked colors, or NULL if no bitmap's colortable + is currently locked. + */ + const SkPMColor* colors() const { return fColors; } + + /** If a previous bitmap has been locked by this object, unlock its colors + first. If the specified bitmap has a colortable, lock its colors and + return them. + */ + const SkPMColor* lockColors(const SkBitmap& bm) { + if (fCTable) { + fCTable->unlockColors(false); + } + fCTable = bm.getColorTable(); + fColors = fCTable ? fCTable->lockColors() : NULL; + return fColors; + } + +private: + SkColorTable* fCTable; + const SkPMColor* fColors; +}; + /////////////////////////////////////////////////////////////////////////////// inline uint32_t* SkBitmap::getAddr32(int x, int y) const { diff --git a/skia/include/SkBlurDrawLooper.h b/skia/include/SkBlurDrawLooper.h index b1c3d20..028b2eb 100644 --- a/skia/include/SkBlurDrawLooper.h +++ b/skia/include/SkBlurDrawLooper.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkBlurDrawLooper_DEFINED #define SkBlurDrawLooper_DEFINED @@ -9,7 +25,7 @@ class SkMaskFilter; /** \class SkBlurDrawLooper This class draws a shadow of the object (possibly offset), and then draws the original object in its original position. - <reed> should there be an option to just draw the shadow/blur layer? webkit? + should there be an option to just draw the shadow/blur layer? webkit? */ class SkBlurDrawLooper : public SkDrawLooper { public: @@ -21,6 +37,10 @@ public: virtual bool next(); virtual void restore(); + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkBlurDrawLooper, (buffer)); + } + protected: SkBlurDrawLooper(SkFlattenableReadBuffer&); // overrides from SkFlattenable @@ -28,9 +48,6 @@ protected: virtual Factory getFactory() { return CreateProc; } private: - static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { - return SkNEW_ARGS(SkBlurDrawLooper, (buffer)); } - SkCanvas* fCanvas; SkPaint* fPaint; SkMaskFilter* fBlur; diff --git a/skia/include/SkBlurMaskFilter.h b/skia/include/SkBlurMaskFilter.h index 9126b6b..b90ea5e 100644 --- a/skia/include/SkBlurMaskFilter.h +++ b/skia/include/SkBlurMaskFilter.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBlurMaskFilter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBlurMaskFilter_DEFINED #define SkBlurMaskFilter_DEFINED diff --git a/skia/include/SkBorderView.h b/skia/include/SkBorderView.h index 400b1a7..94ccc1f 100644 --- a/skia/include/SkBorderView.h +++ b/skia/include/SkBorderView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBorderView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBorderView_DEFINED #define SkBorderView_DEFINED diff --git a/skia/include/SkBounder.h b/skia/include/SkBounder.h index 4ab44cb..f20961d 100644 --- a/skia/include/SkBounder.h +++ b/skia/include/SkBounder.h @@ -1,19 +1,18 @@ -/* include/graphics/SkBounder.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBounder_DEFINED #define SkBounder_DEFINED diff --git a/skia/include/SkCamera.h b/skia/include/SkCamera.h index 3536b06..8bbcabf 100644 --- a/skia/include/SkCamera.h +++ b/skia/include/SkCamera.h @@ -1,19 +1,18 @@ -/* include/graphics/SkCamera.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ diff --git a/skia/include/SkCanvas.h b/skia/include/SkCanvas.h index d306073..a19a5ae 100644 --- a/skia/include/SkCanvas.h +++ b/skia/include/SkCanvas.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include "SkPorterDuff.h" #include "SkPath.h" #include "SkRegion.h" +#include "SkScalarCompare.h" class SkBounder; class SkDevice; @@ -63,7 +64,16 @@ public: /////////////////////////////////////////////////////////////////////////// - virtual bool getViewport(SkIPoint*) const; + /** If this subclass of SkCanvas supports GL viewports, return true and set + size (if not null) to the size of the viewport. If it is not supported, + ignore vp and return false. + */ + virtual bool getViewport(SkIPoint* size) const; + + /** If this subclass of SkCanvas supports GL viewports, return true and set + the viewport to the specified x and y dimensions. If it is not + supported, ignore x and y and return false. + */ virtual bool setViewport(int x, int y); /** Return the canvas' device object, which may be null. The device holds @@ -301,7 +311,7 @@ public: in a way similar to quickReject, in that it tells you that drawing outside of these bounds will be clipped out. */ - bool getClipBounds(SkRect* bounds) const; + bool getClipBounds(SkRect* bounds, EdgeType et = kAA_EdgeType) const; /** Fill the entire canvas' bitmap (restricted to the current clip) with the specified ARGB color, using the specified PorterDuff mode. @@ -434,7 +444,9 @@ public: const SkPaint& paint); /** Draw the specified arc, which will be scaled to fit inside the - specified oval. + specified oval. If the sweep angle is >= 360, then the oval is drawn + completely. Note that this differs slightly from SkPath::arcTo, which + treats the sweep angle mod 360. @param oval The bounds of oval used to define the shape of the arc @param startAngle Starting angle (in degrees) where the arc begins @param sweepAngle Sweep angle (in degrees) measured clockwise @@ -693,6 +705,7 @@ public: SkDevice* device() const; const SkMatrix& matrix() const; const SkRegion& clip() const; + const SkPaint& paint() const; int x() const; int y() const; @@ -700,9 +713,11 @@ public: // used to embed the SkDrawIter object directly in our instance, w/o // having to expose that class def to the public. There is an assert // in our constructor to ensure that fStorage is large enough - // (though needs to be a compile-time-assert!) - uint32_t fStorage[11]; + // (though needs to be a compile-time-assert!). We use intptr_t to work + // safely with 32 and 64 bit machines (to ensure the storage is enough) + intptr_t fStorage[12]; class SkDrawIter* fImpl; // this points at fStorage + SkPaint fDefaultPaint; bool fDone; }; @@ -736,6 +751,21 @@ private: // shared by save() and saveLayer() int internalSave(SaveFlags flags); void internalRestore(); + + /* These maintain a cache of the clip bounds in local coordinates, + (converted to 2s-compliment if floats are slow). + */ + mutable SkRectCompareType fLocalBoundsCompareType; + mutable bool fLocalBoundsCompareTypeDirty; + + const SkRectCompareType& getLocalClipBoundsCompareType() const { + if (fLocalBoundsCompareTypeDirty) { + this->computeLocalClipBoundsCompareType(); + fLocalBoundsCompareTypeDirty = false; + } + return fLocalBoundsCompareType; + } + void computeLocalClipBoundsCompareType() const; }; /** Stack helper class to automatically call restoreToCount() on the canvas diff --git a/skia/include/SkColor.h b/skia/include/SkColor.h index f1cf1b1..c97a8ec 100644 --- a/skia/include/SkColor.h +++ b/skia/include/SkColor.h @@ -1,19 +1,18 @@ -/* include/graphics/SkColor.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkColor_DEFINED #define SkColor_DEFINED diff --git a/skia/include/SkColorFilter.h b/skia/include/SkColorFilter.h index bc89974..a1b3171 100644 --- a/skia/include/SkColorFilter.h +++ b/skia/include/SkColorFilter.h @@ -1,19 +1,18 @@ -/* include/graphics/SkColorFilter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkColorFilter_DEFINED #define SkColorFilter_DEFINED diff --git a/skia/include/SkColorMatrix.h b/skia/include/SkColorMatrix.h index dd4b29f..cee5d6e 100644 --- a/skia/include/SkColorMatrix.h +++ b/skia/include/SkColorMatrix.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Google Inc. + * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/SkColorMatrixFilter.h b/skia/include/SkColorMatrixFilter.h index 4798d37..f9194df 100644 --- a/skia/include/SkColorMatrixFilter.h +++ b/skia/include/SkColorMatrixFilter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Google Inc. + * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/SkColorPriv.h b/skia/include/SkColorPriv.h index 477af0d..09ddb63 100644 --- a/skia/include/SkColorPriv.h +++ b/skia/include/SkColorPriv.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ In debugging, asserts that alpha is 0..255 */ -static inline unsigned SkAlpha255To256(U8CPU alpha) { +inline unsigned SkAlpha255To256(U8CPU alpha) { SkASSERT(SkToU8(alpha) == alpha); return alpha + (alpha >> 7); } @@ -69,7 +69,7 @@ inline int SkAlphaBlend(int src, int dst, int scale256) { #define SkG16Assert(g) SkASSERT((unsigned)(g) <= SK_G16_MASK) #define SkB16Assert(b) SkASSERT((unsigned)(b) <= SK_B16_MASK) -static inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) { +inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) { SkASSERT(r <= SK_R16_MASK); SkASSERT(g <= SK_G16_MASK); SkASSERT(b <= SK_B16_MASK); @@ -84,7 +84,7 @@ static inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) { /** Expand the 16bit color into a 32bit value that can be scaled all at once by a value up to 32. Used in conjunction with SkCompact_rgb_16. */ -static inline uint32_t SkExpand_rgb_16(U16CPU c) { +inline uint32_t SkExpand_rgb_16(U16CPU c) { SkASSERT(c == (uint16_t)c); return ((c & SK_G16_MASK_IN_PLACE) << 16) | (c & ~SK_G16_MASK_IN_PLACE); @@ -96,7 +96,7 @@ static inline uint32_t SkExpand_rgb_16(U16CPU c) { "clean" the top 16bits. However, the top 16 can contain garbage, so it is up to the caller to safely ignore them. */ -static inline U16CPU SkCompact_rgb_16(uint32_t c) { +inline U16CPU SkCompact_rgb_16(uint32_t c) { return ((c >> 16) & SK_G16_MASK_IN_PLACE) | (c & ~SK_G16_MASK_IN_PLACE); } @@ -105,7 +105,7 @@ static inline U16CPU SkCompact_rgb_16(uint32_t c) { to return 32bits, so that the compiler won't generate extra instructions to "clean" the top 16bits. */ -static inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) { +inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) { return SkCompact_rgb_16(SkExpand_rgb_16(c) * (scale >> 3) >> 5); } @@ -117,7 +117,7 @@ static inline U16CPU SkAlphaMulRGB16(U16CPU c, unsigned scale) { to return 32bits, so that the compiler won't generate extra instructions to "clean" the top 16bits. */ -static inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) { +inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) { SkASSERT((unsigned)srcScale <= 256); srcScale >>= 3; @@ -127,7 +127,7 @@ static inline U16CPU SkBlendRGB16(U16CPU src, U16CPU dst, int srcScale) { return SkCompact_rgb_16(dst32 + ((src32 - dst32) * srcScale >> 5)); } -static inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[], +inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[], int srcScale, int count) { SkASSERT(count > 0); SkASSERT((unsigned)srcScale <= 256); @@ -142,7 +142,7 @@ static inline void SkBlendRGB16(const uint16_t src[], uint16_t dst[], } #ifdef SK_DEBUG - static U16CPU SkRGB16Add(U16CPU a, U16CPU b) { + U16CPU SkRGB16Add(U16CPU a, U16CPU b) { SkASSERT(SkGetPackedR16(a) + SkGetPackedR16(b) <= SK_R16_MASK); SkASSERT(SkGetPackedG16(a) + SkGetPackedG16(b) <= SK_G16_MASK); SkASSERT(SkGetPackedB16(a) + SkGetPackedB16(b) <= SK_B16_MASK); @@ -319,7 +319,7 @@ inline uint16_t SkDitherPixel32ToPixel16(SkPMColor c) to saturate properly (and not overflow). If we take the 8 bits as is, it is possible to overflow. */ -static inline uint32_t SkPMColorToExpanded16x5(SkPMColor c) +inline uint32_t SkPMColorToExpanded16x5(SkPMColor c) { unsigned sr = SkPacked32ToR16(c); unsigned sg = SkPacked32ToG16(c); @@ -334,7 +334,7 @@ static inline uint32_t SkPMColorToExpanded16x5(SkPMColor c) /* SrcOver the 32bit src color with the 16bit dst, returning a 16bit value (with dirt in the high 16bits, so caller beware). */ -static inline U16CPU SkSrcOver32To16(SkPMColor src, uint16_t dst) { +inline U16CPU SkSrcOver32To16(SkPMColor src, uint16_t dst) { unsigned sr = SkGetPackedR32(src); unsigned sg = SkGetPackedG32(src); unsigned sb = SkGetPackedB32(src); @@ -402,7 +402,7 @@ typedef uint16_t SkPMColor16; #define SkG32To4444(g) ((unsigned)(g) >> 4) #define SkB32To4444(b) ((unsigned)(b) >> 4) -static inline U8CPU SkReplicateNibble(unsigned nib) +inline U8CPU SkReplicateNibble(unsigned nib) { SkASSERT(nib <= 0xF); return (nib << 4) | nib; @@ -424,7 +424,7 @@ static inline U8CPU SkReplicateNibble(unsigned nib) #define SkPacked4444ToB32(c) SkReplicateNibble(SkGetPackedB4444(c)) #ifdef SK_DEBUG -static inline void SkPMColor16Assert(U16CPU c) +inline void SkPMColor16Assert(U16CPU c) { unsigned a = SkGetPackedA4444(c); unsigned r = SkGetPackedR4444(c); @@ -440,14 +440,14 @@ static inline void SkPMColor16Assert(U16CPU c) #define SkPMColor16Assert(c) #endif -static inline unsigned SkAlpha15To16(unsigned a) +inline unsigned SkAlpha15To16(unsigned a) { SkASSERT(a <= 0xF); return a + (a >> 3); } #ifdef SK_DEBUG - static inline int SkAlphaMul4(int value, int scale) + inline int SkAlphaMul4(int value, int scale) { SkASSERT((unsigned)scale <= 0x10); return value * scale >> 4; @@ -456,25 +456,25 @@ static inline unsigned SkAlpha15To16(unsigned a) #define SkAlphaMul4(value, scale) ((value) * (scale) >> 4) #endif -static inline unsigned SkR4444ToR565(unsigned r) +inline unsigned SkR4444ToR565(unsigned r) { SkASSERT(r <= 0xF); return (r << (SK_R16_BITS - 4)) | (r >> (8 - SK_R16_BITS)); } -static inline unsigned SkG4444ToG565(unsigned g) +inline unsigned SkG4444ToG565(unsigned g) { SkASSERT(g <= 0xF); return (g << (SK_G16_BITS - 4)) | (g >> (8 - SK_G16_BITS)); } -static inline unsigned SkB4444ToB565(unsigned b) +inline unsigned SkB4444ToB565(unsigned b) { SkASSERT(b <= 0xF); return (b << (SK_B16_BITS - 4)) | (b >> (8 - SK_B16_BITS)); } -static inline SkPMColor16 SkPackARGB4444(unsigned a, unsigned r, +inline SkPMColor16 SkPackARGB4444(unsigned a, unsigned r, unsigned g, unsigned b) { SkASSERT(a <= 0xF); @@ -523,13 +523,13 @@ inline uint32_t SkExpand_4444(U16CPU c) would add 2 more instructions, slow us down. It is up to the caller to perform the cast if needed. */ -static inline U16CPU SkCompact_4444(uint32_t c) +inline U16CPU SkCompact_4444(uint32_t c) { const unsigned mask = 0xF0F; //gMask_0F0F; return (c & mask) | ((c >> 12) & ~mask); } -static inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d) +inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d) { unsigned sa = SkGetPackedA4444(s); unsigned sr = SkR4444ToR565(SkGetPackedR4444(s)); @@ -555,14 +555,14 @@ static inline uint16_t SkSrcOver4444To16(SkPMColor16 s, uint16_t d) return SkPackRGB16(sr + dr, sg + dg, sb + db); } -static inline uint16_t SkBlend4444To16(SkPMColor16 src, uint16_t dst, int scale16) +inline uint16_t SkBlend4444To16(SkPMColor16 src, uint16_t dst, int scale16) { SkASSERT((unsigned)scale16 <= 16); return SkSrcOver4444To16(SkAlphaMulQ4(src, scale16), dst); } -static inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16) +inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16) { SkASSERT((unsigned)scale16 <= 16); @@ -579,7 +579,7 @@ static inline uint16_t SkBlend4444(SkPMColor16 src, SkPMColor16 dst, int scale16 return SkCompact_4444((src32 + dst32) >> 4); } -static inline SkPMColor SkPixel4444ToPixel32(U16CPU c) +inline SkPMColor SkPixel4444ToPixel32(U16CPU c) { uint32_t d = (SkGetPackedA4444(c) << SK_A32_SHIFT) | (SkGetPackedR4444(c) << SK_R32_SHIFT) | @@ -588,7 +588,7 @@ static inline SkPMColor SkPixel4444ToPixel32(U16CPU c) return d | (d << 4); } -static inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c) +inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c) { return (((c >> (SK_A32_SHIFT + 4)) & 0xF) << SK_A4444_SHIFT) | (((c >> (SK_R32_SHIFT + 4)) & 0xF) << SK_R4444_SHIFT) | @@ -597,7 +597,7 @@ static inline SkPMColor16 SkPixel32ToPixel4444(SkPMColor c) } // cheap 2x2 dither -static inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r, +inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { a = ((a << 1) - ((a >> 4 << 4) | (a >> 4))) >> 4; @@ -608,7 +608,7 @@ static inline SkPMColor16 SkDitherARGB32To4444(U8CPU a, U8CPU r, return SkPackARGB4444(a, r, g, b); } -static inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c) +inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c) { return SkDitherARGB32To4444(SkGetPackedA32(c), SkGetPackedR32(c), SkGetPackedG32(c), SkGetPackedB32(c)); @@ -618,7 +618,7 @@ static inline SkPMColor16 SkDitherPixel32To4444(SkPMColor c) Transforms a normal ARGB_8888 into the same byte order as expanded ARGB_4444, but keeps each component 8bits */ -static inline uint32_t SkExpand_8888(SkPMColor c) +inline uint32_t SkExpand_8888(SkPMColor c) { return (((c >> SK_R32_SHIFT) & 0xFF) << 24) | (((c >> SK_G32_SHIFT) & 0xFF) << 8) | @@ -629,7 +629,7 @@ static inline uint32_t SkExpand_8888(SkPMColor c) /* Undo the operation of SkExpand_8888, turning the argument back into a SkPMColor. */ -static inline SkPMColor SkCompact_8888(uint32_t c) +inline SkPMColor SkCompact_8888(uint32_t c) { return (((c >> 24) & 0xFF) << SK_R32_SHIFT) | (((c >> 8) & 0xFF) << SK_G32_SHIFT) | @@ -641,7 +641,7 @@ static inline SkPMColor SkCompact_8888(uint32_t c) but this routine just keeps the high 4bits of each component in the low 4bits of the result (just like a newly expanded PMColor16). */ -static inline uint32_t SkExpand32_4444(SkPMColor c) +inline uint32_t SkExpand32_4444(SkPMColor c) { return (((c >> (SK_R32_SHIFT + 4)) & 0xF) << 24) | (((c >> (SK_G32_SHIFT + 4)) & 0xF) << 8) | diff --git a/skia/include/SkColorShader.h b/skia/include/SkColorShader.h index 5a50fa9..f9c3dc3 100644 --- a/skia/include/SkColorShader.h +++ b/skia/include/SkColorShader.h @@ -1,17 +1,18 @@ -/* Copyright 2007, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkColorShader_DEFINED #define SkColorShader_DEFINED diff --git a/skia/include/SkCornerPathEffect.h b/skia/include/SkCornerPathEffect.h index c62718b..a459478 100644 --- a/skia/include/SkCornerPathEffect.h +++ b/skia/include/SkCornerPathEffect.h @@ -1,19 +1,18 @@ -/* include/graphics/SkCornerPathEffect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkCornerPathEffect_DEFINED #define SkCornerPathEffect_DEFINED diff --git a/skia/include/SkCullPoints.h b/skia/include/SkCullPoints.h index 1a4ef52..cee64e2 100644 --- a/skia/include/SkCullPoints.h +++ b/skia/include/SkCullPoints.h @@ -1,19 +1,18 @@ -/* include/graphics/SkCullPoints.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkCullPoints_DEFINED #define SkCullPoints_DEFINED diff --git a/skia/include/SkDOM.h b/skia/include/SkDOM.h index 3cd184d..74e2492 100644 --- a/skia/include/SkDOM.h +++ b/skia/include/SkDOM.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/SkDashPathEffect.h b/skia/include/SkDashPathEffect.h index cb7161e..cc414e3 100644 --- a/skia/include/SkDashPathEffect.h +++ b/skia/include/SkDashPathEffect.h @@ -1,19 +1,18 @@ -/* include/graphics/SkDashPathEffect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkDashPathEffect_DEFINED #define SkDashPathEffect_DEFINED diff --git a/skia/include/SkDeque.h b/skia/include/SkDeque.h index b66a541..cbed930 100644 --- a/skia/include/SkDeque.h +++ b/skia/include/SkDeque.h @@ -1,19 +1,18 @@ -/* include/graphics/SkDeque.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkDeque_DEFINED #define SkDeque_DEFINED diff --git a/skia/include/SkDescriptor.h b/skia/include/SkDescriptor.h index 870390b..8074cff 100644 --- a/skia/include/SkDescriptor.h +++ b/skia/include/SkDescriptor.h @@ -1,19 +1,18 @@ -/* include/graphics/SkDescriptor.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkDescriptor_DEFINED #define SkDescriptor_DEFINED diff --git a/skia/include/SkDevice.h b/skia/include/SkDevice.h index cc3fe5e..4d678c6 100644 --- a/skia/include/SkDevice.h +++ b/skia/include/SkDevice.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkDevice_DEFINED #define SkDevice_DEFINED diff --git a/skia/include/SkDiscretePathEffect.h b/skia/include/SkDiscretePathEffect.h index c5fc9d4..2950950 100644 --- a/skia/include/SkDiscretePathEffect.h +++ b/skia/include/SkDiscretePathEffect.h @@ -1,19 +1,18 @@ -/* include/graphics/SkDiscretePathEffect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkDiscretePathEffect_DEFINED #define SkDiscretePathEffect_DEFINED diff --git a/skia/include/SkDither.h b/skia/include/SkDither.h index d486437..5b2552d 100644 --- a/skia/include/SkDither.h +++ b/skia/include/SkDither.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkDither_DEFINED #define SkDither_DEFINED diff --git a/skia/include/SkDraw.h b/skia/include/SkDraw.h index 39fe9206..2d775a4 100644 --- a/skia/include/SkDraw.h +++ b/skia/include/SkDraw.h @@ -1,19 +1,18 @@ -/* libs/graphics/sgl/SkDraw.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkDraw_DEFINED #define SkDraw_DEFINED @@ -55,9 +54,9 @@ public: int scalarsPerPosition, const SkPaint& paint) const; void drawTextOnPath(const char text[], size_t byteLength, const SkPath&, const SkMatrix*, const SkPaint&) const; - void drawVertices(SkCanvas::VertexMode vmode, int count, + void drawVertices(SkCanvas::VertexMode mode, int count, const SkPoint vertices[], const SkPoint textures[], - const SkColor colors[], SkXfermode* mode, + const SkColor colors[], SkXfermode* xmode, const uint16_t indices[], int ptCount, const SkPaint& paint) const; diff --git a/skia/include/SkDrawExtraPathEffect.h b/skia/include/SkDrawExtraPathEffect.h index 50a43c6..65e255a 100644 --- a/skia/include/SkDrawExtraPathEffect.h +++ b/skia/include/SkDrawExtraPathEffect.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SK_DRAW_EXTRA_PATH_EFFECT_H #define SK_DRAW_EXTRA_PATH_EFFECT_H class SkAnimator; diff --git a/skia/include/SkDrawFilter.h b/skia/include/SkDrawFilter.h index ddf0f74..db5a685 100644 --- a/skia/include/SkDrawFilter.h +++ b/skia/include/SkDrawFilter.h @@ -1,9 +1,25 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkDrawFilter_DEFINED #define SkDrawFilter_DEFINED #include "SkRefCnt.h" -////////////////// EXPERIMENTAL <reed> ////////////////////////// +////////////////// EXPERIMENTAL ////////////////////////// class SkCanvas; class SkPaint; diff --git a/skia/include/SkDrawLooper.h b/skia/include/SkDrawLooper.h index 80c11c3..333fb41 100644 --- a/skia/include/SkDrawLooper.h +++ b/skia/include/SkDrawLooper.h @@ -1,9 +1,25 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkDrawLooper_DEFINED #define SkDrawLooper_DEFINED #include "SkFlattenable.h" -////////////////// EXPERIMENTAL <reed> ////////////////////////// +////////////////// EXPERIMENTAL ////////////////////////// class SkCanvas; class SkPaint; @@ -30,12 +46,19 @@ public: virtual bool next() { return false; } /** Called after the looper has finally returned false from next(), allowing the looper to restore the canvas/paint to their original states. - <reed> is this required, since the subclass knows when it is done??? - <reed> should we pass the canvas/paint here, and/or to the next call + is this required, since the subclass knows when it is done??? + should we pass the canvas/paint here, and/or to the next call so that subclasses don't need to retain pointers to them during the loop? */ virtual void restore() {} + +protected: + SkDrawLooper() {} + SkDrawLooper(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} + +private: + typedef SkFlattenable INHERITED; }; #endif diff --git a/skia/include/SkEmbossMaskFilter.h b/skia/include/SkEmbossMaskFilter.h index dfb8cc6..042a2a6 100644 --- a/skia/include/SkEmbossMaskFilter.h +++ b/skia/include/SkEmbossMaskFilter.h @@ -1,19 +1,18 @@ -/* include/graphics/SkEmbossMaskFilter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkEmbossMaskFilter_DEFINED #define SkEmbossMaskFilter_DEFINED diff --git a/skia/include/SkEvent.h b/skia/include/SkEvent.h index 1830be3..2b43f34 100644 --- a/skia/include/SkEvent.h +++ b/skia/include/SkEvent.h @@ -1,19 +1,18 @@ -/* include/graphics/SkEvent.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkEvent_DEFINED #define SkEvent_DEFINED diff --git a/skia/include/SkEventSink.h b/skia/include/SkEventSink.h index 071b651..27a6743 100644 --- a/skia/include/SkEventSink.h +++ b/skia/include/SkEventSink.h @@ -1,19 +1,18 @@ -/* include/graphics/SkEventSink.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkEventSink_DEFINED #define SkEventSink_DEFINED diff --git a/skia/include/SkFlattenable.h b/skia/include/SkFlattenable.h index 8b2db8a..d23e20f 100644 --- a/skia/include/SkFlattenable.h +++ b/skia/include/SkFlattenable.h @@ -1,18 +1,17 @@ -/* include/graphics/SkFlattenable.h - ** - ** Copyright 2006, Google Inc. - ** - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** - ** http://www.apache.org/licenses/LICENSE-2.0 - ** - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ #ifndef SkFlattenable_DEFINED diff --git a/skia/include/SkFlipPixelRef.h b/skia/include/SkFlipPixelRef.h new file mode 100644 index 0000000..3b4e97a --- /dev/null +++ b/skia/include/SkFlipPixelRef.h @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkFlipPixelRef_DEFINED +#define SkFlipPixelRef_DEFINED + +#include "SkBitmap.h" +#include "SkPageFlipper.h" +#include "SkPixelRef.h" +#include "SkThread.h" + +class SkRegion; + +class SkFlipPixelRef : public SkPixelRef { +public: + SkFlipPixelRef(SkBitmap::Config, int width, int height); + virtual ~SkFlipPixelRef(); + + bool isDirty() const { return fFlipper.isDirty(); } + const SkRegion& dirtyRgn() const { return fFlipper.dirtyRgn(); } + + void inval() { fFlipper.inval(); } + void inval(const SkIRect& rect) { fFlipper.inval(rect); } + void inval(const SkRegion& rgn) { fFlipper.inval(rgn); } + void inval(const SkRect& r, bool doAA) { fFlipper.inval(r, doAA); } + + const SkRegion& beginUpdate(SkBitmap* device); + void endUpdate(); + +private: + void getFrontBack(const void** front, void** back) const { + if (front) { + *front = fPage0; + } + if (back) { + *back = fPage1; + } + } + + void swapPages(); + + // Helper to copy pixels from srcAddr to the dst bitmap, clipped to clip. + // srcAddr points to memory with the same config as dst. + static void CopyBitsFromAddr(const SkBitmap& dst, const SkRegion& clip, + const void* srcAddr); + + // serialization + +public: + virtual Factory getFactory() const { return Create; } + virtual void flatten(SkFlattenableWriteBuffer&) const; + static SkPixelRef* Create(SkFlattenableReadBuffer& buffer); + +protected: + virtual void* onLockPixels(SkColorTable**); + virtual void onUnlockPixels(); + + SkFlipPixelRef(SkFlattenableReadBuffer&); + +private: + SkMutex fMutex; + SkPageFlipper fFlipper; + + void* fStorage; + void* fPage0; // points into fStorage; + void* fPage1; // points into fStorage; + size_t fSize; // size of 1 page. fStorage holds 2 pages + SkBitmap::Config fConfig; + + typedef SkPixelRef INHERITED; +}; + +class SkAutoFlipUpdate : SkNoncopyable { +public: + SkAutoFlipUpdate(SkFlipPixelRef* ref) : fRef(ref) { + fDirty = &ref->beginUpdate(&fBitmap); + } + ~SkAutoFlipUpdate() { + if (fRef) { + fRef->endUpdate(); + } + } + + const SkBitmap& bitmap() const { return fBitmap; } + const SkRegion& dirty() const { return *fDirty; } + + // optional. This gets automatically called in the destructor (only once) + void endUpdate() { + if (fRef) { + fRef->endUpdate(); + fRef = NULL; + } + } + +private: + SkFlipPixelRef* fRef; + SkBitmap fBitmap; + const SkRegion* fDirty; +}; + +#endif diff --git a/skia/include/SkFontCodec.h b/skia/include/SkFontCodec.h index 0a4ca05..09725dc 100644 --- a/skia/include/SkFontCodec.h +++ b/skia/include/SkFontCodec.h @@ -1,19 +1,18 @@ -/* include/graphics/SkFontCodec.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkFontCodec_DEFINED #define SkFontCodec_DEFINED diff --git a/skia/include/SkFontHost.h b/skia/include/SkFontHost.h index 7440295..73010e7 100644 --- a/skia/include/SkFontHost.h +++ b/skia/include/SkFontHost.h @@ -1,19 +1,18 @@ -/* include/graphics/SkFontHost.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkFontHost_DEFINED #define SkFontHost_DEFINED diff --git a/skia/include/SkGLCanvas.h b/skia/include/SkGLCanvas.h index bb731b4..40fc52d 100644 --- a/skia/include/SkGLCanvas.h +++ b/skia/include/SkGLCanvas.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,10 +46,24 @@ public: // settings for the global texture cache static size_t GetTextureCacheMaxCount(); - static size_t GetTextureCacheMaxSize(); static void SetTextureCacheMaxCount(size_t count); + + static size_t GetTextureCacheMaxSize(); static void SetTextureCacheMaxSize(size_t size); - + + /** Call glDeleteTextures for all textures (including those for text) + This should be called while the gl-context is still valid. Its purpose + is to free up gl resources. Note that if a bitmap or text is drawn after + this call, new caches will be created. + */ + static void DeleteAllTextures(); + + /** Forget all textures without calling delete (including those for text). + This should be called if the gl-context has changed, and the texture + IDs that have been cached are no longer valid. + */ + static void AbandonAllTextures(); + private: SkIPoint fViewportSize; diff --git a/skia/include/SkGlobals.h b/skia/include/SkGlobals.h index 586f689..8e28290 100644 --- a/skia/include/SkGlobals.h +++ b/skia/include/SkGlobals.h @@ -1,19 +1,18 @@ -/* include/graphics/SkGlobals.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkGlobals_DEFINED #define SkGlobals_DEFINED diff --git a/skia/include/SkGradientShader.h b/skia/include/SkGradientShader.h index ee1c976..9a8696c 100644 --- a/skia/include/SkGradientShader.h +++ b/skia/include/SkGradientShader.h @@ -1,19 +1,18 @@ -/* include/graphics/SkGradientShader.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkGradientShader_DEFINED #define SkGradientShader_DEFINED diff --git a/skia/include/SkGraphics.h b/skia/include/SkGraphics.h index 841e1a3..cb06128 100644 --- a/skia/include/SkGraphics.h +++ b/skia/include/SkGraphics.h @@ -1,19 +1,18 @@ -/* include/graphics/SkGraphics.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkGraphics_DEFINED #define SkGraphics_DEFINED diff --git a/skia/include/SkImageDecoder.h b/skia/include/SkImageDecoder.h index 8a93ef9..e6389e4 100644 --- a/skia/include/SkImageDecoder.h +++ b/skia/include/SkImageDecoder.h @@ -1,19 +1,18 @@ -/* include/graphics/SkImageDecoder.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkImageDecoder_DEFINED #define SkImageDecoder_DEFINED @@ -101,8 +100,28 @@ public: // approximate the sample size. int getSampleSize() const { return fSampleSize; } void setSampleSize(int size); + + /** Reset the sampleSize to its default of 1 + */ void resetSampleSize() { this->setSampleSize(1); } + /** Decoding is synchronous, but for long decodes, a different thread can + call this method safely. This sets a state that the decoders will + periodically check, and if they see it changed to cancel, they will + cancel. This will result in decode() returning false. However, there is + no guarantee that the decoder will see the state change in time, so + it is possible that cancelDecode() will be called, but will be ignored + and decode() will return true (assuming no other problems were + encountered). + + This state is automatically reset at the beginning of decode(). + */ + void cancelDecode() { + // now the subclass must query shouldCancelDecode() to be informed + // of the request + fShouldCancelDecode = true; + } + /** Passed to the decode method. If kDecodeBounds_Mode is passed, then only the bitmap's width/height/config need be set. If kDecodePixels_Mode is passed, then the bitmap must have pixels or a pixelRef. @@ -120,10 +139,9 @@ public: bitmap. It can then set the pixels with the decompressed image. If the image cannot be decompressed, return false. - note: document use of Allocator, Peeker and Chooser <reed> + note: document use of Allocator, Peeker and Chooser */ - virtual bool onDecode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref, - Mode) = 0; + bool decode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref, Mode); /** Given a stream, this will try to find an appropriate decoder object. If none is found, the method returns NULL. @@ -206,6 +224,23 @@ public: /** @endcond */ protected: + // must be overridden in subclasses. This guy is called by decode(...) + virtual bool onDecode(SkStream*, SkBitmap* bitmap, SkBitmap::Config pref, + Mode) = 0; + + /** Can be queried from within onDecode, to see if the user (possibly in + a different thread) has requested the decode to cancel. If this returns + true, your onDecode() should stop and return false. + Each subclass needs to decide how often it can query this, to balance + responsiveness with performance. + + Calling this outside of onDecode() may return undefined values. + */ + +public: + bool shouldCancelDecode() const { return fShouldCancelDecode; } + +protected: SkImageDecoder(); // helper function for decoders to handle the (common) case where there is only @@ -224,6 +259,7 @@ private: SkBitmap::Allocator* fAllocator; int fSampleSize; bool fDitherImage; + mutable bool fShouldCancelDecode; // illegal SkImageDecoder(const SkImageDecoder&); @@ -258,4 +294,3 @@ protected: /////////////////////////////////////////////////////////////////////// #endif - diff --git a/skia/include/SkImageRef.h b/skia/include/SkImageRef.h index 6ffb340..1e1ed59 100644 --- a/skia/include/SkImageRef.h +++ b/skia/include/SkImageRef.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkImageRef_DEFINED #define SkImageRef_DEFINED @@ -34,6 +50,9 @@ public: /** Return true if the image can be decoded. If so, and bitmap is non-null, call its setConfig() with the corresponding values, but explicitly will not set its pixels or colortable. Use SkPixelRef::lockPixels() for that. + + If there has been an error decoding the bitmap, this will return false + and ignore the bitmap parameter. */ bool getInfo(SkBitmap* bm); diff --git a/skia/include/SkImageRef_GlobalPool.h b/skia/include/SkImageRef_GlobalPool.h index 5469697..a9d4dce 100644 --- a/skia/include/SkImageRef_GlobalPool.h +++ b/skia/include/SkImageRef_GlobalPool.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkImageRef_GlobalPool_DEFINED #define SkImageRef_GlobalPool_DEFINED diff --git a/skia/include/SkImageView.h b/skia/include/SkImageView.h index 974a611..157abb1 100644 --- a/skia/include/SkImageView.h +++ b/skia/include/SkImageView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkImageView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkImageView_DEFINED #define SkImageView_DEFINED diff --git a/skia/include/SkJS.h b/skia/include/SkJS.h index f584d6f..fe76352 100644 --- a/skia/include/SkJS.h +++ b/skia/include/SkJS.h @@ -1,19 +1,18 @@ -/* include/graphics/SkJS.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include "SkTypes.h" #include "SkWindow.h" diff --git a/skia/include/SkKernel33MaskFilter.h b/skia/include/SkKernel33MaskFilter.h index 3fbc9cd..84136e2 100644 --- a/skia/include/SkKernel33MaskFilter.h +++ b/skia/include/SkKernel33MaskFilter.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkKernel33MaskFilter_DEFINED #define SkKernel33MaskFilter_DEFINED diff --git a/skia/include/SkKey.h b/skia/include/SkKey.h index 2d0a8aa..3fd5114 100644 --- a/skia/include/SkKey.h +++ b/skia/include/SkKey.h @@ -1,19 +1,18 @@ -/* include/graphics/SkKey.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkKey_DEFINED #define SkKey_DEFINED diff --git a/skia/include/SkLayerDrawLooper.h b/skia/include/SkLayerDrawLooper.h new file mode 100644 index 0000000..670ac23 --- /dev/null +++ b/skia/include/SkLayerDrawLooper.h @@ -0,0 +1,70 @@ +#ifndef SkLayerDrawLooper_DEFINED +#define SkLayerDrawLooper_DEFINED + +#include "SkDrawLooper.h" + +struct SkPoint; + +class SkLayerDrawLooper : public SkDrawLooper { +public: + SkLayerDrawLooper(); + virtual ~SkLayerDrawLooper(); + + /** Call for each layer you want to add (from top to bottom). + This returns a paint you can modify, but that ptr is only valid until + the next call made to this object. + */ + SkPaint* addLayer(SkScalar dx, SkScalar dy); + + /** Helper for addLayer() which passes (0, 0) for the offset parameters + */ + SkPaint* addLayer() { + return this->addLayer(0, 0); + } + + // overrides from SkDrawLooper + virtual void init(SkCanvas*, SkPaint*); + virtual bool next(); + virtual void restore(); + + // must be public for Registrar :( + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkLayerDrawLooper, (buffer)); + } + +protected: + SkLayerDrawLooper(SkFlattenableReadBuffer&); + + // overrides from SkFlattenable + virtual void flatten(SkFlattenableWriteBuffer& ); + virtual Factory getFactory() { return CreateProc; } + +private: + struct Rec { + Rec* fNext; + SkPaint fPaint; + SkPoint fOffset; + + static Rec* Reverse(Rec*); + }; + Rec* fRecs; + int fCount; + + struct Iter { + SkPaint fSavedPaint; + SkPaint* fPaint; + SkCanvas* fCanvas; + Rec* fRec; + }; + Iter fIter; + + class MyRegistrar : public SkFlattenable::Registrar { + public: + MyRegistrar(); + }; + + typedef SkDrawLooper INHERITED; +}; + + +#endif diff --git a/skia/include/SkLayerRasterizer.h b/skia/include/SkLayerRasterizer.h index 6a59e94..820f6fc 100644 --- a/skia/include/SkLayerRasterizer.h +++ b/skia/include/SkLayerRasterizer.h @@ -1,19 +1,18 @@ -/* include/graphics/SkLayerRasterizer.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkLayerRasterizer_DEFINED #define SkLayerRasterizer_DEFINED diff --git a/skia/include/SkMMapStream.h b/skia/include/SkMMapStream.h index 196231b..600c621 100644 --- a/skia/include/SkMMapStream.h +++ b/skia/include/SkMMapStream.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkMMapStream_DEFINED #define SkMMapStream_DEFINED diff --git a/skia/include/SkMallocPixelRef.h b/skia/include/SkMallocPixelRef.h new file mode 100644 index 0000000..b6a013d --- /dev/null +++ b/skia/include/SkMallocPixelRef.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkMallocPixelRef_DEFINED +#define SkMallocPixelRef_DEFINED + +#include "SkPixelRef.h" + +/** We explicitly use the same allocator for our pixels that SkMask does, + so that we can freely assign memory allocated by one class to the other. +*/ +class SkMallocPixelRef : public SkPixelRef { +public: + /** Allocate the specified buffer for pixels. The memory is freed when the + last owner of this pixelref is gone. + */ + SkMallocPixelRef(void* addr, size_t size, SkColorTable* ctable); + virtual ~SkMallocPixelRef(); + + //! Return the allocation size for the pixels + size_t getSize() const { return fSize; } + + // overrides from SkPixelRef + virtual void flatten(SkFlattenableWriteBuffer&) const; + virtual Factory getFactory() const { + return Create; + } + static SkPixelRef* Create(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkMallocPixelRef, (buffer)); + } + +protected: + // overrides from SkPixelRef + virtual void* onLockPixels(SkColorTable**); + virtual void onUnlockPixels(); + + SkMallocPixelRef(SkFlattenableReadBuffer& buffer); + +private: + void* fStorage; + size_t fSize; + SkColorTable* fCTable; + + typedef SkPixelRef INHERITED; +}; + +#endif diff --git a/skia/include/SkMask.h b/skia/include/SkMask.h index d5c14ea..764ead6 100644 --- a/skia/include/SkMask.h +++ b/skia/include/SkMask.h @@ -1,19 +1,18 @@ -/* include/graphics/SkMask.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkMask_DEFINED #define SkMask_DEFINED diff --git a/skia/include/SkMaskFilter.h b/skia/include/SkMaskFilter.h index 243972f..749a73a 100644 --- a/skia/include/SkMaskFilter.h +++ b/skia/include/SkMaskFilter.h @@ -1,19 +1,18 @@ -/* include/graphics/SkMaskFilter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkMaskFilter_DEFINED #define SkMaskFilter_DEFINED diff --git a/skia/include/SkMetaData.h b/skia/include/SkMetaData.h index e87278b..21739fe 100644 --- a/skia/include/SkMetaData.h +++ b/skia/include/SkMetaData.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/SkMovie.h b/skia/include/SkMovie.h index d1ac280..45962a5 100644 --- a/skia/include/SkMovie.h +++ b/skia/include/SkMovie.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkMovie_DEFINED #define SkMovie_DEFINED diff --git a/skia/include/SkNinePatch.h b/skia/include/SkNinePatch.h index a10d8be..a655621 100644 --- a/skia/include/SkNinePatch.h +++ b/skia/include/SkNinePatch.h @@ -1,19 +1,18 @@ /* -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkNinePatch_DEFINED #define SkNinePatch_DEFINED diff --git a/skia/include/SkOSFile.h b/skia/include/SkOSFile.h index a62d65a..de8090c 100644 --- a/skia/include/SkOSFile.h +++ b/skia/include/SkOSFile.h @@ -1,21 +1,19 @@ -/* include/graphics/SkOSFile.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -// Copyright Skia Inc. 2004 - 2005 // #ifndef SkOSFile_DEFINED #define SkOSFile_DEFINED diff --git a/skia/include/SkOSMenu.h b/skia/include/SkOSMenu.h index 3b429b4..433a601 100644 --- a/skia/include/SkOSMenu.h +++ b/skia/include/SkOSMenu.h @@ -1,19 +1,18 @@ -/* include/graphics/SkOSMenu.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkOSMenu_DEFINED #define SkOSMenu_DEFINED diff --git a/skia/include/SkOSSound.h b/skia/include/SkOSSound.h index 034e1bd..5d77955 100644 --- a/skia/include/SkOSSound.h +++ b/skia/include/SkOSSound.h @@ -1,19 +1,18 @@ -/* include/graphics/SkOSSound.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkOSSound_DEFINED #define SkOSSound_DEFINED diff --git a/skia/include/SkOSWindow_Mac.h b/skia/include/SkOSWindow_Mac.h index 8c4628f..1f6a1fa 100644 --- a/skia/include/SkOSWindow_Mac.h +++ b/skia/include/SkOSWindow_Mac.h @@ -1,19 +1,18 @@ -/* include/graphics/SkOSWindow_Mac.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkOSWindow_Mac_DEFINED #define SkOSWindow_Mac_DEFINED diff --git a/skia/include/SkOSWindow_Unix.h b/skia/include/SkOSWindow_Unix.h index b616ca9..26f51be 100644 --- a/skia/include/SkOSWindow_Unix.h +++ b/skia/include/SkOSWindow_Unix.h @@ -1,19 +1,18 @@ -/* include/graphics/SkOSWindow_Unix.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkOSWindow_Unix_DEFINED #define SkOSWindow_Unix_DEFINED diff --git a/skia/include/SkOSWindow_Win.h b/skia/include/SkOSWindow_Win.h index 79b99e7..6d821db 100644 --- a/skia/include/SkOSWindow_Win.h +++ b/skia/include/SkOSWindow_Win.h @@ -1,19 +1,18 @@ -/* include/graphics/SkOSWindow_Win.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkOSWindow_Win_DEFINED #define SkOSWindow_Win_DEFINED diff --git a/skia/include/SkOSWindow_wxwidgets.h b/skia/include/SkOSWindow_wxwidgets.h index 7d7bb80e..c5dfc7c 100644 --- a/skia/include/SkOSWindow_wxwidgets.h +++ b/skia/include/SkOSWindow_wxwidgets.h @@ -1,25 +1,23 @@ -/* include/graphics/SkOSWindow_wxwidgets.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * SkOSWindow_wxwidgets.h * wxwidgets * - * Created by phanna on 12/14/05. * Copyright 2005 __MyCompanyName__. All rights reserved. * */ @@ -52,4 +50,3 @@ private: }; #endifpedef SkWindow INHERITED; - diff --git a/skia/include/SkPackBits.h b/skia/include/SkPackBits.h index 4bbfb55..c11231b 100644 --- a/skia/include/SkPackBits.h +++ b/skia/include/SkPackBits.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkPackBits_DEFINED #define SkPackBits_DEFINED diff --git a/skia/include/SkPaint.h b/skia/include/SkPaint.h index cc6f760..bb386c6 100644 --- a/skia/include/SkPaint.h +++ b/skia/include/SkPaint.h @@ -1,19 +1,18 @@ -/* include/graphics/SkPaint.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPaint_DEFINED #define SkPaint_DEFINED @@ -368,6 +367,35 @@ public: */ bool getFillPath(const SkPath& src, SkPath* dst) const; + /** Returns true if the current paint settings allow for fast computation of + bounds (i.e. there is nothing complex like a patheffect that would make + the bounds computation expensive. + */ + bool canComputeFastBounds() const; + + /** Only call this if canComputeFastBounds() returned true. This takes a + raw rectangle (the raw bounds of a shape), and adjusts it for stylistic + effects in the paint (e.g. stroking). If needed, it uses the storage + rect parameter. It returns the adjusted bounds that can then be used + for quickReject tests. + + The returned rect will either be orig or storage, thus the caller + should not rely on storage being set to the result, but should always + use the retured value. It is legal for orig and storage to be the same + rect. + + e.g. + if (paint.canComputeFastBounds()) { + SkRect r, storage; + path.computeBounds(&r, SkPath::kFast_BoundsType); + const SkRect& fastR = paint.computeFastBounds(r, &storage); + if (canvas->quickReject(fastR, ...)) { + // don't draw the path + } + } + */ + const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const; + /** Get the paint's shader object. <p /> The shader's reference count is not affected. diff --git a/skia/include/SkPaintFlagsDrawFilter.h b/skia/include/SkPaintFlagsDrawFilter.h index 7f489f9..941be245 100644 --- a/skia/include/SkPaintFlagsDrawFilter.h +++ b/skia/include/SkPaintFlagsDrawFilter.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkPaintFlagsDrawFilter_DEFINED #define SkPaintFlagsDrawFilter_DEFINED diff --git a/skia/include/SkParse.h b/skia/include/SkParse.h index b066f6a..57d040c 100644 --- a/skia/include/SkParse.h +++ b/skia/include/SkParse.h @@ -1,19 +1,18 @@ -/* include/graphics/SkParse.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkParse_DEFINED #define SkParse_DEFINED diff --git a/skia/include/SkParsePaint.h b/skia/include/SkParsePaint.h index 32b84f9..d23cd92 100644 --- a/skia/include/SkParsePaint.h +++ b/skia/include/SkParsePaint.h @@ -1,19 +1,18 @@ -/* include/graphics/SkParsePaint.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkParsePaint_DEFINED #define SkParsePaint_DEFINED diff --git a/skia/include/SkPath.h b/skia/include/SkPath.h index f5859a9..e2409ad 100644 --- a/skia/include/SkPath.h +++ b/skia/include/SkPath.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ class SkFlattenableReadBuffer; class SkFlattenableWriteBuffer; +class SkAutoPathBoundsUpdate; class SkString; /** \class SkPath @@ -296,11 +297,12 @@ public: the path is different from the path's current last point, then an automatic lineTo() is added to connect the current contour to the start of the arc. However, if the path is empty, then we call moveTo() with - the first point of the arc. + the first point of the arc. The sweep angle is treated mod 360. @param oval The bounding oval defining the shape and size of the arc @param startAngle Starting angle (in degrees) where the arc begins - @param sweepAngle Sweep angle (in degrees) measured clockwise + @param sweepAngle Sweep angle (in degrees) measured clockwise. This is + treated mod 360. @param forceMoveTo If true, always begin a new contour with the arc */ void arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, @@ -579,6 +581,7 @@ private: void reversePathTo(const SkPath&); friend const SkPoint* sk_get_path_points(const SkPath&, int index); + friend class SkAutoPathBoundsUpdate; }; #endif diff --git a/skia/include/SkPathEffect.h b/skia/include/SkPathEffect.h index 03ea6a4..f97adb7 100644 --- a/skia/include/SkPathEffect.h +++ b/skia/include/SkPathEffect.h @@ -1,19 +1,18 @@ -/* include/graphics/SkPathEffect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPathEffect_DEFINED #define SkPathEffect_DEFINED diff --git a/skia/include/SkPathMeasure.h b/skia/include/SkPathMeasure.h index f1ce8ab..5ab97ca 100644 --- a/skia/include/SkPathMeasure.h +++ b/skia/include/SkPathMeasure.h @@ -1,19 +1,18 @@ -/* include/graphics/SkPathMeasure.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPathMeasure_DEFINED #define SkPathMeasure_DEFINED diff --git a/skia/include/SkPicture.h b/skia/include/SkPicture.h index 15836de..fa614c9 100644 --- a/skia/include/SkPicture.h +++ b/skia/include/SkPicture.h @@ -1,19 +1,18 @@ /* -** -** Copyright 2007, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPicture_DEFINED #define SkPicture_DEFINED @@ -87,6 +86,12 @@ public: void serialize(SkWStream*) const; + /** Signals that the caller is prematurely done replaying the drawing + commands. This can be called from a canvas virtual while the picture + is drawing. Has no effect if the picture is not drawing. + */ + void abortPlayback(); + private: int fWidth, fHeight; SkPictureRecord* fRecord; diff --git a/skia/include/SkPixelRef.h b/skia/include/SkPixelRef.h index 4bab04e..0ddfedc 100644 --- a/skia/include/SkPixelRef.h +++ b/skia/include/SkPixelRef.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkPixelRef_DEFINED #define SkPixelRef_DEFINED diff --git a/skia/include/SkPixelXorXfermode.h b/skia/include/SkPixelXorXfermode.h index d755d11..369e0e5 100644 --- a/skia/include/SkPixelXorXfermode.h +++ b/skia/include/SkPixelXorXfermode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Google Inc. + * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/SkPorterDuff.h b/skia/include/SkPorterDuff.h index 8ea2363..f03e9cb 100644 --- a/skia/include/SkPorterDuff.h +++ b/skia/include/SkPorterDuff.h @@ -1,19 +1,18 @@ -/* include/graphics/SkPorterDuff.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPorterDuff_DEFINED #define SkPorterDuff_DEFINED @@ -45,8 +44,8 @@ public: kSrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc] kDstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)] kXor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] - kDarken_Mode, //!< [Sa + Da - Sa*Da, Sc\u00B7(1 - Da) + Dc\u00B7(1 - Sa) + min(Sc, Dc)] - kLighten_Mode, //!< [Sa + Da - Sa*Da, Sc\u00B7(1 - Da) + Dc\u00B7(1 - Sa) + max(Sc, Dc)] + kDarken_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + min(Sc, Dc)] + kLighten_Mode, //!< [Sa + Da - Sa*Da, Sc*(1 - Da) + Dc*(1 - Sa) + max(Sc, Dc)] kMultiply_Mode, //!< [Sa * Da, Sc * Dc] kScreen_Mode, //!< [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] diff --git a/skia/include/SkProgressBarView.h b/skia/include/SkProgressBarView.h index 5783f83..6341fcb 100644 --- a/skia/include/SkProgressBarView.h +++ b/skia/include/SkProgressBarView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkProgressBarView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkProgressBarView_DEFINED #define SkProgressBarView_DEFINED diff --git a/skia/include/SkPtrRecorder.h b/skia/include/SkPtrRecorder.h index 969b816..ff1e14d 100644 --- a/skia/include/SkPtrRecorder.h +++ b/skia/include/SkPtrRecorder.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkPtrRecorder_DEFINED #define SkPtrRecorder_DEFINED @@ -8,7 +24,7 @@ class SkPtrRecorder : public SkRefCnt { public: uint32_t recordPtr(void*); - size_t count() const { return fList.count(); } + int count() const { return fList.count(); } void getPtrs(void* array[]) const; void reset(); diff --git a/skia/include/SkRasterizer.h b/skia/include/SkRasterizer.h index b717c14..d81e613 100644 --- a/skia/include/SkRasterizer.h +++ b/skia/include/SkRasterizer.h @@ -1,19 +1,18 @@ -/* include/graphics/SkRasterizer.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkRasterizer_DEFINED #define SkRasterizer_DEFINED diff --git a/skia/include/SkReader32.h b/skia/include/SkReader32.h index 174c1ec..1c72a87 100644 --- a/skia/include/SkReader32.h +++ b/skia/include/SkReader32.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkReader32_DEFINED #define SkReader32_DEFINED @@ -22,8 +38,8 @@ public: fStop = (const char*)data + size; } - uint32_t size() const { return static_cast<uint32_t>(fStop - fBase); } - uint32_t offset() const { return static_cast<uint32_t>(fCurr - fBase); } + uint32_t size() const { return fStop - fBase; } + uint32_t offset() const { return fCurr - fBase; } bool eof() const { return fCurr >= fStop; } const void* base() const { return fBase; } const void* peek() const { return fCurr; } diff --git a/skia/include/SkRefCnt.h b/skia/include/SkRefCnt.h index 8a5abbf..adb59dd 100644 --- a/skia/include/SkRefCnt.h +++ b/skia/include/SkRefCnt.h @@ -1,19 +1,18 @@ -/* include/graphics/SkRefCnt.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkRefCnt_DEFINED #define SkRefCnt_DEFINED diff --git a/skia/include/SkSVGAttribute.h b/skia/include/SkSVGAttribute.h index 4b14d04..810d11c 100644 --- a/skia/include/SkSVGAttribute.h +++ b/skia/include/SkSVGAttribute.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSVGAttribute.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSVGAttribute_DEFINED #define SkSVGAttribute_DEFINED diff --git a/skia/include/SkSVGBase.h b/skia/include/SkSVGBase.h index fff98cc..4d24aed 100644 --- a/skia/include/SkSVGBase.h +++ b/skia/include/SkSVGBase.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSVGBase.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSVGBase_DEFINED #define SkSVGBase_DEFINED diff --git a/skia/include/SkSVGPaintState.h b/skia/include/SkSVGPaintState.h index 2f30e42..f3f74e1 100644 --- a/skia/include/SkSVGPaintState.h +++ b/skia/include/SkSVGPaintState.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSVGPaintState.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSVGPaintState_DEFINED #define SkSVGPaintState_DEFINED diff --git a/skia/include/SkSVGParser.h b/skia/include/SkSVGParser.h index 60cbcbd..86ae4c2 100644 --- a/skia/include/SkSVGParser.h +++ b/skia/include/SkSVGParser.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSVGParser.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSVGParser_DEFINED #define SkSVGParser_DEFINED diff --git a/skia/include/SkSVGTypes.h b/skia/include/SkSVGTypes.h index 24404ad..38d63ce 100644 --- a/skia/include/SkSVGTypes.h +++ b/skia/include/SkSVGTypes.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSVGTypes.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSVGTypes_DEFINED #define SkSVGTypes_DEFINED diff --git a/skia/include/SkScalerContext.h b/skia/include/SkScalerContext.h index 0b8981f..ec2cd0d 100644 --- a/skia/include/SkScalerContext.h +++ b/skia/include/SkScalerContext.h @@ -1,19 +1,18 @@ -/* include/graphics/SkScalerContext.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkScalerContext_DEFINED #define SkScalerContext_DEFINED @@ -90,7 +89,10 @@ struct SkGlyph { kSubBits = 2, kSubMask = ((1 << kSubBits) - 1), kSubShift = 24, // must be large enough for glyphs and unichars - kCodeMask = ((1 << kSubShift) - 1) + kCodeMask = ((1 << kSubShift) - 1), + // relative offsets for X and Y subpixel bits + kSubShiftX = kSubBits, + kSubShiftY = 0 }; static unsigned ID2Code(uint32_t id) { @@ -98,11 +100,11 @@ struct SkGlyph { } static unsigned ID2SubX(uint32_t id) { - return id >> (kSubShift + kSubBits); + return id >> (kSubShift + kSubShiftX); } static unsigned ID2SubY(uint32_t id) { - return (id >> kSubShift) & kSubMask; + return (id >> (kSubShift + kSubShiftY)) & kSubMask; } static unsigned FixedToSub(SkFixed n) { @@ -122,7 +124,9 @@ struct SkGlyph { SkASSERT(code <= kCodeMask); x = FixedToSub(x); y = FixedToSub(y); - return (x << (kSubShift + kSubBits)) | (y << kSubShift) | code; + return (x << (kSubShift + kSubShiftX)) | + (y << (kSubShift + kSubShiftY)) | + code; } void toMask(SkMask* mask) const; diff --git a/skia/include/SkScrollBarView.h b/skia/include/SkScrollBarView.h index 514ad74..b8a5209 100644 --- a/skia/include/SkScrollBarView.h +++ b/skia/include/SkScrollBarView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkScrollBarView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkScrollBarView_DEFINED #define SkScrollBarView_DEFINED diff --git a/skia/include/SkShader.h b/skia/include/SkShader.h index 69ae15a..7c13e3d 100644 --- a/skia/include/SkShader.h +++ b/skia/include/SkShader.h @@ -1,19 +1,18 @@ -/* include/graphics/SkShader.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkShader_DEFINED #define SkShader_DEFINED diff --git a/skia/include/SkShaderExtras.h b/skia/include/SkShaderExtras.h index 8c43f5c..765f411 100644 --- a/skia/include/SkShaderExtras.h +++ b/skia/include/SkShaderExtras.h @@ -1,19 +1,18 @@ -/* include/graphics/SkShaderExtras.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkShaderExtras_DEFINED #define SkShaderExtras_DEFINED diff --git a/skia/include/SkStackViewLayout.h b/skia/include/SkStackViewLayout.h index f0bb092..8000319 100644 --- a/skia/include/SkStackViewLayout.h +++ b/skia/include/SkStackViewLayout.h @@ -1,19 +1,18 @@ -/* include/graphics/SkStackViewLayout.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkStackViewLayout_DEFINED #define SkStackViewLayout_DEFINED diff --git a/skia/include/SkStream.h b/skia/include/SkStream.h index 4612abb..26ef43f 100644 --- a/skia/include/SkStream.h +++ b/skia/include/SkStream.h @@ -1,19 +1,18 @@ -/* include/graphics/SkStream.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkStream_DEFINED #define SkStream_DEFINED @@ -69,6 +68,8 @@ public: bool readBool() { return this->readU8() != 0; } SkScalar readScalar(); size_t readPackedUInt(); + + static void UnitTest(); }; class SkWStream : SkNoncopyable { @@ -101,7 +102,7 @@ public: bool writeStream(SkStream* input, size_t length); - SkDEBUGCODE(static void UnitTest();) + static void UnitTest(); }; //////////////////////////////////////////////////////////////////////////////////////// @@ -110,9 +111,15 @@ public: struct SkFILE; +/** A stream that reads from a FILE*, which is opened in the constructor and + closed in the destructor + */ class SkFILEStream : public SkStream { public: - SkFILEStream(const char path[] = NULL); + /** Initialize the stream by calling fopen on the specified path. Will be + closed in the destructor. + */ + explicit SkFILEStream(const char path[] = NULL); virtual ~SkFILEStream(); /** Returns true if the current path could be opened. @@ -122,8 +129,6 @@ public: path. If path is NULL, just close the current file. */ void setPath(const char path[]); - - SkFILE* getSkFILE() const { return fFILE; } virtual bool rewind(); virtual size_t read(void* buffer, size_t size); @@ -134,6 +139,30 @@ private: SkString fName; }; +/** A stream that reads from a file descriptor + */ +class SkFDStream : public SkStream { +public: + /** Initialize the stream with a dup() of the specified file descriptor. + If closeWhenDone is true, then the descriptor will be closed in the + destructor. + */ + SkFDStream(int fileDesc, bool closeWhenDone); + virtual ~SkFDStream(); + + /** Returns true if the current path could be opened. + */ + bool isValid() const { return fFD >= 0; } + + virtual bool rewind(); + virtual size_t read(void* buffer, size_t size); + virtual const char* getFileName() { return NULL; } + +private: + int fFD; + bool fCloseWhenDone; +}; + class SkMemoryStream : public SkStream { public: SkMemoryStream(); @@ -175,14 +204,18 @@ public: /** Provide the stream to be buffered (proxy), and the size of the buffer that should be used. This will be allocated and freed automatically. If bufferSize is 0, a default buffer size will be used. + The proxy stream is referenced, and will be unreferenced in when the + bufferstream is destroyed. */ - SkBufferStream(SkStream& proxy, size_t bufferSize = 0); + SkBufferStream(SkStream* proxy, size_t bufferSize = 0); /** Provide the stream to be buffered (proxy), and a buffer and size to be used. This buffer is owned by the caller, and must be at least bufferSize bytes big. Passing NULL for buffer will cause the buffer to be allocated/freed automatically. If buffer is not NULL, it is an error for bufferSize to be 0. + The proxy stream is referenced, and will be unreferenced in when the + bufferstream is destroyed. */ - SkBufferStream(SkStream& proxy, void* buffer, size_t bufferSize); + SkBufferStream(SkStream* proxy, void* buffer, size_t bufferSize); virtual ~SkBufferStream(); virtual bool rewind(); @@ -198,7 +231,7 @@ private: SkBufferStream(const SkBufferStream&); SkBufferStream& operator=(const SkBufferStream&); - SkStream& fProxy; + SkStream* fProxy; char* fBuffer; size_t fOrigBufferSize, fBufferSize, fBufferOffset; bool fWeOwnTheBuffer; diff --git a/skia/include/SkStream_Win.h b/skia/include/SkStream_Win.h index 02ab5b1..1b17450 100644 --- a/skia/include/SkStream_Win.h +++ b/skia/include/SkStream_Win.h @@ -1,19 +1,18 @@ -/* include/graphics/SkStream_Win.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkStream_Win_DEFINED #define SkStream_Win_DEFINED diff --git a/skia/include/SkString.h b/skia/include/SkString.h index 3c02b22..46b1d9e 100644 --- a/skia/include/SkString.h +++ b/skia/include/SkString.h @@ -1,19 +1,18 @@ -/* include/graphics/SkString.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkString_DEFINED #define SkString_DEFINED diff --git a/skia/include/SkStroke.h b/skia/include/SkStroke.h index bc1ca4a..b593b69 100644 --- a/skia/include/SkStroke.h +++ b/skia/include/SkStroke.h @@ -1,19 +1,18 @@ -/* include/graphics/SkStroke.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkStroke_DEFINED #define SkStroke_DEFINED diff --git a/skia/include/SkSystemEventTypes.h b/skia/include/SkSystemEventTypes.h index 726d880..8dfe8be 100644 --- a/skia/include/SkSystemEventTypes.h +++ b/skia/include/SkSystemEventTypes.h @@ -1,19 +1,18 @@ -/* include/graphics/SkSystemEventTypes.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkSystemEventTypes_DEFINED #define SkSystemEventTypes_DEFINED diff --git a/skia/include/SkTDArray.h b/skia/include/SkTDArray.h index 620ecc5..4d2d7f7 100644 --- a/skia/include/SkTDArray.h +++ b/skia/include/SkTDArray.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTDArray.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTDArray_DEFINED #define SkTDArray_DEFINED @@ -88,7 +87,7 @@ public: } bool isEmpty() const { return fCount == 0; } - size_t count() const { return fCount; } + int count() const { return fCount; } T* begin() const { return fArray; } T* end() const { return fArray ? fArray + fCount : NULL; } T& operator[](int index) const { diff --git a/skia/include/SkTDStack.h b/skia/include/SkTDStack.h index e070cb9..5bc10ee 100644 --- a/skia/include/SkTDStack.h +++ b/skia/include/SkTDStack.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTDStack.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTDStack_DEFINED #define SkTDStack_DEFINED diff --git a/skia/include/SkTDict.h b/skia/include/SkTDict.h index cd7d555..0b92779 100644 --- a/skia/include/SkTDict.h +++ b/skia/include/SkTDict.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTDict.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTDict_DEFINED #define SkTDict_DEFINED diff --git a/skia/include/SkTextBox.h b/skia/include/SkTextBox.h index 1d7f46c..2c34448 100644 --- a/skia/include/SkTextBox.h +++ b/skia/include/SkTextBox.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTextBox.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTextBox_DEFINED #define SkTextBox_DEFINED diff --git a/skia/include/SkTime.h b/skia/include/SkTime.h index 6733501..9ee7110 100644 --- a/skia/include/SkTime.h +++ b/skia/include/SkTime.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTime.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTime_DEFINED #define SkTime_DEFINED diff --git a/skia/include/SkTransparentShader.h b/skia/include/SkTransparentShader.h index 82b56da..8bc60ff 100644 --- a/skia/include/SkTransparentShader.h +++ b/skia/include/SkTransparentShader.h @@ -1,19 +1,18 @@ -/* include/graphics/SkTransparentShader.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTransparentShader_DEFINED #define SkTransparentShader_DEFINED diff --git a/skia/include/SkTypeface.h b/skia/include/SkTypeface.h index bcdb021..546edca 100644 --- a/skia/include/SkTypeface.h +++ b/skia/include/SkTypeface.h @@ -1,17 +1,18 @@ -/* Copyright 2006-2008, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTypeface_DEFINED #define SkTypeface_DEFINED diff --git a/skia/include/SkUnPreMultiply.h b/skia/include/SkUnPreMultiply.h index bbbcea1..4bdb980 100644 --- a/skia/include/SkUnPreMultiply.h +++ b/skia/include/SkUnPreMultiply.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + diff --git a/skia/include/SkUnitMapper.h b/skia/include/SkUnitMapper.h index 9d7c65b..5d1ea35 100644 --- a/skia/include/SkUnitMapper.h +++ b/skia/include/SkUnitMapper.h @@ -1,19 +1,18 @@ -/* include/graphics/SkUnitMapper.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkUnitMapper_DEFINED #define SkUnitMapper_DEFINED diff --git a/skia/include/SkUnitMappers.h b/skia/include/SkUnitMappers.h index a1331bb..51708b6 100644 --- a/skia/include/SkUnitMappers.h +++ b/skia/include/SkUnitMappers.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkUnitMappers_DEFINED #define SkUnitMappers_DEFINED diff --git a/skia/include/SkUtils.h b/skia/include/SkUtils.h index 5ec3caa..f3e3341 100644 --- a/skia/include/SkUtils.h +++ b/skia/include/SkUtils.h @@ -1,19 +1,18 @@ -/* include/graphics/SkUtils.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkUtils_DEFINED #define SkUtils_DEFINED diff --git a/skia/include/SkView.h b/skia/include/SkView.h index feb186d..d5d89df 100644 --- a/skia/include/SkView.h +++ b/skia/include/SkView.h @@ -1,19 +1,18 @@ -/* include/graphics/SkView.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkView_DEFINED #define SkView_DEFINED diff --git a/skia/include/SkViewInflate.h b/skia/include/SkViewInflate.h index 354aed4..3ec65a6 100644 --- a/skia/include/SkViewInflate.h +++ b/skia/include/SkViewInflate.h @@ -1,19 +1,18 @@ -/* include/graphics/SkViewInflate.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkViewInflate_DEFINED #define SkViewInflate_DEFINED diff --git a/skia/include/SkWidget.h b/skia/include/SkWidget.h index 9087330..db85f01 100644 --- a/skia/include/SkWidget.h +++ b/skia/include/SkWidget.h @@ -1,19 +1,18 @@ -/* include/graphics/SkWidget.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkWidget_DEFINED #define SkWidget_DEFINED diff --git a/skia/include/SkWidgetViews.h b/skia/include/SkWidgetViews.h index 0b74156..4dd8866 100644 --- a/skia/include/SkWidgetViews.h +++ b/skia/include/SkWidgetViews.h @@ -1,19 +1,18 @@ -/* include/graphics/SkWidgetViews.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkWidgetViews_DEFINED #define SkWidgetViews_DEFINED diff --git a/skia/include/SkWindow.h b/skia/include/SkWindow.h index e70e04b..96262ee 100644 --- a/skia/include/SkWindow.h +++ b/skia/include/SkWindow.h @@ -1,19 +1,18 @@ -/* include/graphics/SkWindow.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkWindow_DEFINED #define SkWindow_DEFINED diff --git a/skia/include/SkWriter32.h b/skia/include/SkWriter32.h index 66910d1..aeeb37d 100644 --- a/skia/include/SkWriter32.h +++ b/skia/include/SkWriter32.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SkWriter32_DEFINED #define SkWriter32_DEFINED diff --git a/skia/include/SkXMLParser.h b/skia/include/SkXMLParser.h index 98f106c..ddad273 100644 --- a/skia/include/SkXMLParser.h +++ b/skia/include/SkXMLParser.h @@ -1,19 +1,18 @@ -/* include/graphics/SkXMLParser.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkXMLParser_DEFINED #define SkXMLParser_DEFINED diff --git a/skia/include/SkXMLWriter.h b/skia/include/SkXMLWriter.h index f60aef4..742e7f1 100644 --- a/skia/include/SkXMLWriter.h +++ b/skia/include/SkXMLWriter.h @@ -1,19 +1,18 @@ -/* include/graphics/SkXMLWriter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkXMLWriter_DEFINED #define SkXMLWriter_DEFINED diff --git a/skia/include/SkXfermode.h b/skia/include/SkXfermode.h index 8de5e65d..f7e6510 100644 --- a/skia/include/SkXfermode.h +++ b/skia/include/SkXfermode.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/Sk64.h b/skia/include/corecg/Sk64.h index 4d5343c..c4ae41e 100644 --- a/skia/include/corecg/Sk64.h +++ b/skia/include/corecg/Sk64.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkBuffer.h b/skia/include/corecg/SkBuffer.h index b1cfefc..bc11a1e 100644 --- a/skia/include/corecg/SkBuffer.h +++ b/skia/include/corecg/SkBuffer.h @@ -1,19 +1,18 @@ -/* include/corecg/SkBuffer.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkBuffer_DEFINED #define SkBuffer_DEFINED diff --git a/skia/include/corecg/SkChunkAlloc.h b/skia/include/corecg/SkChunkAlloc.h index aa4ebde..0e9ad18 100644 --- a/skia/include/corecg/SkChunkAlloc.h +++ b/skia/include/corecg/SkChunkAlloc.h @@ -1,19 +1,18 @@ -/* include/corecg/SkChunkAlloc.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkChunkAlloc_DEFINED #define SkChunkAlloc_DEFINED diff --git a/skia/include/corecg/SkEndian.h b/skia/include/corecg/SkEndian.h index 0897914..f08a9a9 100644 --- a/skia/include/corecg/SkEndian.h +++ b/skia/include/corecg/SkEndian.h @@ -1,19 +1,18 @@ -/* include/corecg/SkEndian.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkEndian_DEFINED #define SkEndian_DEFINED diff --git a/skia/include/corecg/SkFDot6.h b/skia/include/corecg/SkFDot6.h index 57d4516..a4b9cf7 100644 --- a/skia/include/corecg/SkFDot6.h +++ b/skia/include/corecg/SkFDot6.h @@ -1,19 +1,18 @@ -/* include/corecg/SkFDot6.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkFDot6_DEFINED #define SkFDot6_DEFINED diff --git a/skia/include/corecg/SkFixed.h b/skia/include/corecg/SkFixed.h index e77d455..be4bf99 100644 --- a/skia/include/corecg/SkFixed.h +++ b/skia/include/corecg/SkFixed.h @@ -1,19 +1,18 @@ -/* include/corecg/SkFixed.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkFixed_DEFINED #define SkFixed_DEFINED diff --git a/skia/include/corecg/SkFloatBits.h b/skia/include/corecg/SkFloatBits.h new file mode 100644 index 0000000..1628f6e --- /dev/null +++ b/skia/include/corecg/SkFloatBits.h @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkFloatBits_DEFINED +#define SkFloatBits_DEFINED + +#include "SkTypes.h" + +/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement + int. This also converts -0 (0x80000000) to 0. Doing this to a float allows + it to be compared using normal C operators (<, <=, etc.) +*/ +static inline int32_t SkSignBitTo2sCompliment(int32_t x) { + if (x < 0) { + x &= 0x7FFFFFFF; + x = -x; + } + return x; +} + +/** Convert a 2s compliment int to a sign-bit (i.e. int interpreted as float). + This undoes the result of SkSignBitTo2sCompliment(). + */ +static inline int32_t Sk2sComplimentToSignBit(int32_t x) { + int sign = x >> 31; + // make x positive + x = (x ^ sign) - sign; + // set the sign bit as needed + x |= sign << 31; + return x; +} + +/** Given the bit representation of a float, return its value cast to an int. + If the value is out of range, or NaN, return return +/- SK_MaxS32 +*/ +int32_t SkFloatBits_toIntCast(int32_t floatBits); + +/** Given the bit representation of a float, return its floor as an int. + If the value is out of range, or NaN, return return +/- SK_MaxS32 + */ +int32_t SkFloatBits_toIntFloor(int32_t floatBits); + +/** Given the bit representation of a float, return it rounded to an int. + If the value is out of range, or NaN, return return +/- SK_MaxS32 + */ +int32_t SkFloatBits_toIntRound(int32_t floatBits); + +/** Given the bit representation of a float, return its ceiling as an int. + If the value is out of range, or NaN, return return +/- SK_MaxS32 + */ +int32_t SkFloatBits_toIntCeil(int32_t floatBits); + + +#ifdef SK_CAN_USE_FLOAT + +union SkFloatIntUnion { + float fFloat; + int32_t fSignBitInt; +}; + +// Helper to see a float as its bit pattern (w/o aliasing warnings) +static inline int32_t SkFloat2Bits(float x) { + SkFloatIntUnion data; + data.fFloat = x; + return data.fSignBitInt; +} + +// Helper to see a bit pattern as a float (w/o aliasing warnings) +static inline float SkBits2Float(int32_t floatAsBits) { + SkFloatIntUnion data; + data.fSignBitInt = floatAsBits; + return data.fFloat; +} + +/** Return the float as a 2s compliment int. Just to be used to compare floats + to each other or against positive float-bit-constants (like 0). This does + not return the int equivalent of the float, just something cheaper for + compares-only. + */ +static inline int32_t SkFloatAs2sCompliment(float x) { + return SkSignBitTo2sCompliment(SkFloat2Bits(x)); +} + +/** Return the 2s compliment int as a float. This undos the result of + SkFloatAs2sCompliment + */ +static inline float Sk2sComplimentAsFloat(int32_t x) { + return SkBits2Float(Sk2sComplimentToSignBit(x)); +} + +/** Return x cast to a float (i.e. (float)x) +*/ +float SkIntToFloatCast(int x); +float SkIntToFloatCast_NoOverflowCheck(int x); + +/** Return the float cast to an int. + If the value is out of range, or NaN, return +/- SK_MaxS32 +*/ +static inline int32_t SkFloatToIntCast(float x) { + return SkFloatBits_toIntCast(SkFloat2Bits(x)); +} + +/** Return the floor of the float as an int. + If the value is out of range, or NaN, return +/- SK_MaxS32 +*/ +static inline int32_t SkFloatToIntFloor(float x) { + return SkFloatBits_toIntFloor(SkFloat2Bits(x)); +} + +/** Return the float rounded to an int. + If the value is out of range, or NaN, return +/- SK_MaxS32 +*/ +static inline int32_t SkFloatToIntRound(float x) { + return SkFloatBits_toIntRound(SkFloat2Bits(x)); +} + +/** Return the ceiling of the float as an int. + If the value is out of range, or NaN, return +/- SK_MaxS32 +*/ +static inline int32_t SkFloatToIntCeil(float x) { + return SkFloatBits_toIntCeil(SkFloat2Bits(x)); +} + +#endif + +// Scalar wrappers for float-bit routines + +#ifdef SK_SCALAR_IS_FLOAT + #define SkScalarAs2sCompliment(x) SkFloatAs2sCompliment(x) + #define Sk2sComplimentAsScalar(x) Sk2sComplimentAsFloat(x) +#else + #define SkScalarAs2sCompliment(x) (x) + #define Sk2sComplimentAsScalar(x) (x) +#endif + +#endif + diff --git a/skia/include/corecg/SkFloatingPoint.h b/skia/include/corecg/SkFloatingPoint.h index b7c0435..d3a6fc5 100644 --- a/skia/include/corecg/SkFloatingPoint.h +++ b/skia/include/corecg/SkFloatingPoint.h @@ -1,19 +1,18 @@ -/* include/corecg/SkFloatingPoint.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkFloatingPoint_DEFINED #define SkFloatingPoint_DEFINED @@ -24,6 +23,7 @@ #include <math.h> #include <float.h> +#include "SkFloatBits.h" #ifdef SK_BUILD_FOR_WINCE #define sk_float_sqrt(x) (float)::sqrt(x) @@ -61,5 +61,15 @@ #define sk_float_isNaN(x) _isnan(x) #endif +#ifdef SK_USE_FLOATBITS + #define sk_float_floor2int(x) SkFloatToIntFloor(x) + #define sk_float_round2int(x) SkFloatToIntRound(x) + #define sk_float_ceil2int(x) SkFloatToIntCeil(x) +#else + #define sk_float_floor2int(x) (int)sk_float_floor(x) + #define sk_float_round2int(x) (int)sk_float_floor((x) + 0.5f) + #define sk_float_ceil2int(x) (int)sk_float_ceil(x) +#endif + #endif #endif diff --git a/skia/include/corecg/SkInterpolator.h b/skia/include/corecg/SkInterpolator.h index d98196d..c03eb23 100644 --- a/skia/include/corecg/SkInterpolator.h +++ b/skia/include/corecg/SkInterpolator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkMath.h b/skia/include/corecg/SkMath.h index d9fb274..5c2b475 100644 --- a/skia/include/corecg/SkMath.h +++ b/skia/include/corecg/SkMath.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkMatrix.h b/skia/include/corecg/SkMatrix.h index 60fdd42..04751f2 100644 --- a/skia/include/corecg/SkMatrix.h +++ b/skia/include/corecg/SkMatrix.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkPageFlipper.h b/skia/include/corecg/SkPageFlipper.h new file mode 100644 index 0000000..0d791ee --- /dev/null +++ b/skia/include/corecg/SkPageFlipper.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkPageFlipper_DEFINED +#define SkPageFlipper_DEFINED + +#include "SkRegion.h" + +/** SkPageFlipper manages alternating inval/dirty regions for a rectangular area + (like a bitmap). You call inval() to accumulate inval areas, and then when + you're ready to "flip" pages (i.e. draw into the one you've been + invalidating) you call update, which swaps the inval regions, and returns + two things to you: 1) the final inval region to be drawn into, and 2) the + region of pixels that should be copied from the "front" page onto the one + you're about to draw into. This copyBits region will be disjoint from the + inval region, so both need to be handled. + */ +class SkPageFlipper { +public: + SkPageFlipper(); + SkPageFlipper(int width, int height); + + int width() const { return fWidth; } + int height() const { return fHeight; } + + void resize(int width, int height); + + bool isDirty() const { return !fDirty1->isEmpty(); } + const SkRegion& dirtyRgn() const { return *fDirty1; } + + void inval(); + void inval(const SkIRect&); + void inval(const SkRegion&); + void inval(const SkRect&, bool antialias); + + /** When you're ready to write to the back page, call update. The returned + region is the invalidate are that needs to be drawn to. The copyBits + region (provided by the caller) is the area that should be copied from + the front page to the back page (will not intersect with the returned + inval region. + + Once this is called, the two internal regions are swapped, so the *new* + back inval region is ready to receive new inval calls. + */ + const SkRegion& update(SkRegion* copyBits); + +private: + SkRegion* fDirty0; + SkRegion* fDirty1; + SkRegion fDirty0Storage; + SkRegion fDirty1Storage; + int fWidth; + int fHeight; +}; + +#endif + diff --git a/skia/include/corecg/SkPerspIter.h b/skia/include/corecg/SkPerspIter.h index 1a5d82f..81ce7c8 100644 --- a/skia/include/corecg/SkPerspIter.h +++ b/skia/include/corecg/SkPerspIter.h @@ -1,19 +1,18 @@ -/* include/corecg/SkPerspIter.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPerspIter_DEFINED #define SkPerspIter_DEFINED diff --git a/skia/include/corecg/SkPoint.h b/skia/include/corecg/SkPoint.h index 4493ce3..f038afb 100644 --- a/skia/include/corecg/SkPoint.h +++ b/skia/include/corecg/SkPoint.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkPostConfig.h b/skia/include/corecg/SkPostConfig.h index 3ca5f75..b2190ba 100644 --- a/skia/include/corecg/SkPostConfig.h +++ b/skia/include/corecg/SkPostConfig.h @@ -1,19 +1,18 @@ -/* include/corecg/SkPostConfig.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPostConfig_DEFINED #define SkPostConfig_DEFINED @@ -64,6 +63,8 @@ #endif #endif +/////////////////////////////////////////////////////////////////////////////// + #ifndef SkNEW #define SkNEW(type_name) new type_name #define SkNEW_ARGS(type_name, args) new type_name args @@ -82,6 +83,13 @@ /////////////////////////////////////////////////////////////////////////////// +#if defined(SK_SOFTWARE_FLOAT) && defined(SK_SCALAR_IS_FLOAT) + // if this is defined, we convert floats to 2scompliment ints for compares + #ifndef SK_SCALAR_SLOW_COMPARES + #define SK_SCALAR_SLOW_COMPARES + #endif +#endif + #ifdef SK_BUILD_FOR_WIN ////////////////////////////////////////////////////////////////////// // Begin Chrome-specific changes diff --git a/skia/include/corecg/SkPreConfig.h b/skia/include/corecg/SkPreConfig.h index c651dd4..04f1987 100644 --- a/skia/include/corecg/SkPreConfig.h +++ b/skia/include/corecg/SkPreConfig.h @@ -1,19 +1,18 @@ -/* include/corecg/SkPreConfig.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkPreConfig_DEFINED #define SkPreConfig_DEFINED diff --git a/skia/include/corecg/SkRandom.h b/skia/include/corecg/SkRandom.h index 8994fc4..33b563a 100644 --- a/skia/include/corecg/SkRandom.h +++ b/skia/include/corecg/SkRandom.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Google Inc. + * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/skia/include/corecg/SkRect.h b/skia/include/corecg/SkRect.h index 65a562e..a9f25aa 100644 --- a/skia/include/corecg/SkRect.h +++ b/skia/include/corecg/SkRect.h @@ -1,19 +1,18 @@ -/* include/corecg/SkRect.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkRect_DEFINED #define SkRect_DEFINED @@ -280,6 +279,16 @@ struct SkRect { fRight = right; fBottom = bottom; } + + /** Initialize the rect with the 4 specified integers. The routine handles + converting them to scalars (by calling SkIntToScalar) + */ + void iset(int left, int top, int right, int bottom) { + fLeft = SkIntToScalar(left); + fTop = SkIntToScalar(top); + fRight = SkIntToScalar(right); + fBottom = SkIntToScalar(bottom); + } /** Set this rectangle to be the bounds of the array of points. If the array is empty (count == 0), then set this rectangle diff --git a/skia/include/corecg/SkRegion.h b/skia/include/corecg/SkRegion.h index 238524a..d3bfb4a 100644 --- a/skia/include/corecg/SkRegion.h +++ b/skia/include/corecg/SkRegion.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2007 Google Inc. + * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,6 +108,16 @@ public: drawn by the path (with no antialiasing) with the specified clip. */ bool setPath(const SkPath&, const SkRegion& clip); + + /** Returns true if the specified rectangle has a non-empty intersection + with this region. + */ + bool intersects(const SkIRect&) const; + + /** Returns true if the specified region has a non-empty intersection + with this region. + */ + bool intersects(const SkRegion&) const; /** Return true if the specified x,y coordinate is inside the region. */ diff --git a/skia/include/corecg/SkScalar.h b/skia/include/corecg/SkScalar.h index 3e737ae..86341eb 100644 --- a/skia/include/corecg/SkScalar.h +++ b/skia/include/corecg/SkScalar.h @@ -1,19 +1,18 @@ -/* include/corecg/SkScalar.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkScalar_DEFINED #define SkScalar_DEFINED @@ -82,13 +81,13 @@ #define SkScalarFraction(x) sk_float_mod(x, 1.0f) /** Rounds the SkScalar to the nearest integer value */ - #define SkScalarRound(x) (int)sk_float_floor((x) + 0.5f) + #define SkScalarRound(x) sk_float_round2int(x) /** Returns the smallest integer that is >= the specified SkScalar */ - #define SkScalarCeil(x) (int)sk_float_ceil(x) + #define SkScalarCeil(x) sk_float_ceil2int(x) /** Returns the largest integer that is <= the specified SkScalar */ - #define SkScalarFloor(x) (int)sk_float_floor(x) + #define SkScalarFloor(x) sk_float_floor2int(x) /** Returns the absolute value of the specified SkScalar */ #define SkScalarAbs(x) sk_float_abs(x) @@ -228,13 +227,7 @@ #define SkMinScalar(a, b) SkMin32(a, b) #endif -#ifndef SK_SCALAR_IS_FLOAT -#define SK_ScalarNearlyZero SK_FixedNearlyZero -#else -/* Allow a little more flexibility for floating-point scalars - */ -#define SK_ScalarNearlyZero (SK_Scalar1 / (1<<15)) -#endif +#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12)) /* <= is slower than < for floats, so we use < for our tolerance test */ diff --git a/skia/include/corecg/SkScalarCompare.h b/skia/include/corecg/SkScalarCompare.h new file mode 100644 index 0000000..fee554c --- /dev/null +++ b/skia/include/corecg/SkScalarCompare.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SkScalarCompare_DEFINED +#define SkScalarCompare_DEFINED + +#include "SkFloatBits.h" +#include "SkRect.h" + +#ifdef SK_SCALAR_SLOW_COMPARES + typedef int32_t SkScalarCompareType; + typedef SkIRect SkRectCompareType; + #define SkScalarToCompareType(x) SkScalarAs2sCompliment(x) +#else + typedef SkScalar SkScalarCompareType; + typedef SkRect SkRectCompareType; + #define SkScalarToCompareType(x) (x) +#endif + +#endif + diff --git a/skia/include/corecg/SkTSearch.h b/skia/include/corecg/SkTSearch.h index ca1e467..f29e6f5 100644 --- a/skia/include/corecg/SkTSearch.h +++ b/skia/include/corecg/SkTSearch.h @@ -1,19 +1,18 @@ -/* include/corecg/SkTSearch.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTSearch_DEFINED #define SkTSearch_DEFINED diff --git a/skia/include/corecg/SkTemplates.h b/skia/include/corecg/SkTemplates.h index cfe42d9..c81be2a 100644 --- a/skia/include/corecg/SkTemplates.h +++ b/skia/include/corecg/SkTemplates.h @@ -1,19 +1,18 @@ -/* include/corecg/SkTemplates.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkTemplates_DEFINED #define SkTemplates_DEFINED diff --git a/skia/include/corecg/SkThread.h b/skia/include/corecg/SkThread.h index 8dc2402..637492d 100644 --- a/skia/include/corecg/SkThread.h +++ b/skia/include/corecg/SkThread.h @@ -1,19 +1,18 @@ -/* include/corecg/SkThread.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkThread_DEFINED #define SkThread_DEFINED diff --git a/skia/include/corecg/SkThread_platform.h b/skia/include/corecg/SkThread_platform.h index b94bc42..825b737 100644 --- a/skia/include/corecg/SkThread_platform.h +++ b/skia/include/corecg/SkThread_platform.h @@ -1,19 +1,18 @@ -/* include/corecg/SkThread_platform.h -** -** Copyright 2006, Google Inc. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef SkThread_platform_DEFINED #define SkThread_platform_DEFINED diff --git a/skia/include/corecg/SkTypes.h b/skia/include/corecg/SkTypes.h index b67cf1d..0554c73 100644 --- a/skia/include/corecg/SkTypes.h +++ b/skia/include/corecg/SkTypes.h @@ -1,16 +1,16 @@ /* - * Copyright 2006, Google Inc. + * Copyright (C) 2006 The Android Open Source Project * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and * limitations under the License. */ |